ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   For Each statement (https://www.excelbanter.com/excel-programming/277179-each-statement.html)

jacqui[_2_]

For Each statement
 

The following code only hides the columns for the first
sheet even though all sheets in the array aSheets are
selected. Do I need to activate each sheet to get it to
work? If so how would I code the For Each statement. Any
help is appreciated.
Many thanks
Jacqui

ThisWorkbook.Sheets(aSheets).Select
Range("A1").Select
iCCount = ActiveSheet.Range("IV7").End
(xlToLeft).Column

For i = 2 To iCCount
Selection.Offset(0, i).EntireColumn.Hidden
= False
Next


jacqui[_2_]

Answered my own question
 

I've resolved this! But it there any news on my earlier
post, regarding the calculation of minus working days for
a timetable.


-----Original Message-----

The following code only hides the columns for the first
sheet even though all sheets in the array aSheets are
selected. Do I need to activate each sheet to get it to
work? If so how would I code the For Each statement.

Any
help is appreciated.
Many thanks
Jacqui

ThisWorkbook.Sheets(aSheets).Select
Range("A1").Select
iCCount = ActiveSheet.Range("IV7").End
(xlToLeft).Column

For i = 2 To iCCount
Selection.Offset(0,

i).EntireColumn.Hidden
= False
Next

.



All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com