View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AndrewJ[_2_] AndrewJ[_2_] is offline
external usenet poster
 
Posts: 5
Default Using Command Button to Hide Columns in another worksheet

Hello All,

I created what I thought was a really simple workbook, but have run
across a macro error that I can't seem to solve. Probably really simple
for some, but has stumped me on working any further on the workbook:

I recorded a macro to hide a column on a specific worksheet (code
below):

Sheets("Sheet1").Select
Columns("H:H").Select
Selection.EntireColumn.Hidden = True

However, when I copied the code to a command button on another
worksheet I get:

"Run-time error '1004':

Select method of Range class failed"

The macro works fine when I run it through the menu, however it will
not work with the command button. When I click on the Debug, it
highlights the "Columns("H:H").Select"

Any insight will be appreciated...