View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default For each sheet in workbook

Hi T De Villiers

It always run the code on the same sheet (activesheet)

Use
Sh.Columns("C:E").Hidden = True


--
Regards Ron de Bruin
http://www.rondebruin.nl


"T De Villiers" wrote in message
news:T.De.Villiers.265hqz_1144844102.3895@excelfor um-nospam.com...

The following is meant to hide columns c-e in each worksheet in a
workbook.
Not quite working as it doesnt operate for each and every worksheet

Thanks in advance


Sub hidecols()
Dim sh As Worksheet


For Each sh In ThisWorkbook.Worksheets
Columns("C:E").Hidden = True
Next
End Sub


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=532226