Tuesday 26 November 2013

How to select multiple ranges in a worksheet in excel macro?

Sub select_multiple_range()

'We can select multiple range using below code

Worksheets(1).Range("A1:B8,C1:D8").Font.Bold = True


'In above code we have selected 2 ranges. First one is A1:B8 and other is from C1:D8

'To access each range separately, we can use below syntax

'In below code we have displayed the total number of cells in first range (area)
MsgBox Worksheets(1).Range("A1:B8,C1:D8").Areas(1).Cells.Count

End Sub


What do you think on above excel macro topic? Please provide your input, comments, questions on excel macro. I will try to reply as soon as possible. I value your opinion on Excel Macros.

No comments:

Post a Comment

Popular Posts

Search This Blog