Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88081

How to sort values with VBA without changing the formatting?

$
0
0

Workbook The code does exactly what it should, but i would like to know if there is away to sort the values only, without changing the formatting? As of now the cells in the ranges have 2 different colors. So is it possible to prevent it from messing up the color scheme?

Private Sub CommandButton2_Click()

Range("A36:H160").UnMerge

Range("A36:H160").Sort Key1:=Range("B36")

Order1 = xlAscending
Header = xlNo

Range("E36:H160").Merge (True)


Range("K36:R76").UnMerge

Range("K36:R76").Sort Key1:=Range("L36")

Order1 = xlAscending
Header = xlNo

Range("O36:R76").Merge (True)

End Sub

Viewing all articles
Browse latest Browse all 88081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>