Question
December 13, 2007 at 12:50 PM
john.dc

Excel VBA jumping to another worksheet

by john.dc . Updated 18 years, 11 months ago

I have the following (cut down code):

Private Sub CommandButton1_Click()

Sheets(“Sheet2”).Select
Columns(“A:g”).Hidden = True

End Sub

The CommandButton1 is on sheet1, I want the above code to hide the columns on sheet2, but it keeps hiding the columns on sheet1. Is there a setFocus command?
Any help would be appreciated.
Cheers
John

This discussion is locked

All Comments