Answers for "excel vba select multiple ranges"

VBA
1

excel vba select multiple ranges

Sub ClearRanges() 
    ' Using the Range Property
    Worksheets("Sheet1").Range("C5:D9,G9:H16,B14:D18").ClearContents
    Range("MyRange, YourRange, HisRange").ClearContents 
    ' Using the Union Method
    Dim myMultipleRange As Range
    Set myMultipleRange = Union(Sheets("Sheet1").Range("A1:B2"), _
        Sheets("Sheet1").Range("C3:D4"))
    myMultipleRange.ClearContents
End Sub
Posted by: Guest on June-04-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language