![]() |
Code not hiding columns
I recorded the following code that should hide Col. F in
Sheets 1, 2, and 3. This works fine when I record, but when I run the code manually Col. F hides on Sheet 1 only, while the column is merely selected on Sheets 2 & 3. Any idea what happens here? Thanks in advance! Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select Columns("F:F").Select Selection.EntireColumn.Hidden = True Sheets("Sheet1").Select End Sub |
Code not hiding columns
try
Sub hidecolf() For Each ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3")) ws.Columns("F:F").EntireColumn.Hidden = True Next ws End Sub -- Don Guillett SalesAid Software "Eva Shanley" wrote in message ... I recorded the following code that should hide Col. F in Sheets 1, 2, and 3. This works fine when I record, but when I run the code manually Col. F hides on Sheet 1 only, while the column is merely selected on Sheets 2 & 3. Any idea what happens here? Thanks in advance! Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select Columns("F:F").Select Selection.EntireColumn.Hidden = True Sheets("Sheet1").Select End Sub |
Code not hiding columns
Don,
Thanks for the answer! I understand now why the original code didn't work. -----Original Message----- try Sub hidecolf() For Each ws In Sheets(Array("Sheet1", "Sheet2", "Sheet3")) ws.Columns("F:F").EntireColumn.Hidden = True Next ws End Sub -- Don Guillett SalesAid Software "Eva Shanley" wrote in message ... I recorded the following code that should hide Col. F in Sheets 1, 2, and 3. This works fine when I record, but when I run the code manually Col. F hides on Sheet 1 only, while the column is merely selected on Sheets 2 & 3. Any idea what happens here? Thanks in advance! Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select Columns("F:F").Select Selection.EntireColumn.Hidden = True Sheets("Sheet1").Select End Sub . |
Code not hiding columns
|
All times are GMT +1. The time now is 11:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com