Selecting Multiple Columns

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
 
R

Ron de Bruin

Try this Jay

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top