How To Select Multiple Columns In Excel Vba

To select multiple columns in Excel VBA, you can use the Range object’s Columns property. Here’s an example that demonstrates how to do it:

    
Sub SelectMultipleColumns()
    Dim selectedColumns As Range
    
    ' Select columns B, C and D
    Set selectedColumns = Range("B:D")
    
    ' Do something with the selected columns
    selectedColumns.Select
    
    ' Alternatively, you can loop through columns
    Dim column As Range
    For Each column In selectedColumns.Columns
        ' Do something with each column
    Next column
End Sub
    
  

Same cateogry post

Leave a comment