Question Locked

Excel VBA jumping to another worksheet

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

1 reply

This discussion is closed to new replies.