Selecting Multiple Columns

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

How can I select multiple columns in Excel using VBA when
the number of columns is a variable? I have a variable
that tells me how many columns to select. How can I make
VB select the number of columns (for hiding) based on the
variable that I have?

Jay
 
Try this Jay

Sub test()
Dim var As Integer
var = 3
Columns(ActiveCell.Column).Resize(, var).Hidden = True
End Sub
 
Back
Top