Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I posted this earlier and received a couple of solutions, but they did
not work - any ideas - below is a recap: I have two workbooks/files - both workbooks have the same macro below that hides every other column starting with Column B. Sub hidecol() Application.Calculation = xlCalculationManual Application.ScreenUpdating = False For i = 2 To 255 Step 2 If Columns(i).Hidden = False Then Columns(i).Hidden = True Else Columns(i).Hidden = False End If Next i Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub In workbook/file 1 it works just fine but in Workbook 2, it stops at the following line: Columns(i).Hidden = True The error msg = "unable to set the Hidden Property of the range class". The only difference (that I can detect) between the 2 workbooks is in Workbook 2 there are more columns that contain data than in workbook 1. Past suggestions were as follows: # 1 "Comments and other objects on the screen can stop columns hiding. If you have such, right click them, go to format and in properties choose "move and size with cells". " I had already checked this setting. # 2 Sub hidecol() Dim ws As Worksheet Dim i As Long Set ws = Worksheets("Sheet1") Application.Calculation = xlCalculationManual Application.ScreenUpdating = False ws.Columns("A:IV").Hidden = False For i = 2 To 255 Step 2 ws.Columns(i).Hidden = True Next i Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub I tried this code but get the same error msg as above (my code). Any other ideas - much thx, |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hiding a column of hyperlinks behind a column of numbers | New Users to Excel | |||
Problem with Hiding Every Other Column | Excel Programming | |||
Hiding column if cell in previous column is empty-revised | Excel Programming | |||
Hiding Column Also hiding text | Excel Programming | |||
Need help hiding/unhiding column based on autofilter selection in a different column | Excel Programming |