nikkinickyniki
New Member
- Joined
- Mar 21, 2014
- Messages
- 2
Hi all,
I'm trying to go through a list on sheet3 which is populated with only true or false, then using this I want to hide or unhide the corresponding columns using R1C1 notation in sheet1. I'm fairly new to vba and not sure what is wrong with my code. I get an "application-defined or object-defined error".
Also I'm using excel 2010.
Here is my code.
Sub hide_columns()
Dim x As Integer
Dim y As String
For x = 1 To 17
Worksheets("Sheet1").Range(Cells(1, x)).EntireColumn.Hidden = Worksheets("Sheet3").Range(Cells(x, 2)).Value
Next x
End Sub
Any help will be appreciated. Thanks.
I'm trying to go through a list on sheet3 which is populated with only true or false, then using this I want to hide or unhide the corresponding columns using R1C1 notation in sheet1. I'm fairly new to vba and not sure what is wrong with my code. I get an "application-defined or object-defined error".
Also I'm using excel 2010.
Here is my code.
Sub hide_columns()
Dim x As Integer
Dim y As String
For x = 1 To 17
Worksheets("Sheet1").Range(Cells(1, x)).EntireColumn.Hidden = Worksheets("Sheet3").Range(Cells(x, 2)).Value
Next x
End Sub
Any help will be appreciated. Thanks.