Hi all,
I have created a basic macro which hides columns before and after a specified range. I have calculated the column numbers from a user specified date in excel and want to use these cell references in my VBA code to hide the columns.
For example:
Cell B9's formular tells me the users date starts at column 37.
Cell B10's formular tells me the users date ends at column 42.
Becuase these dates change I need to reference cells B9 and B10 and not the column numbers 37 and 42.
So I want to hide colomns 4:B9 and B10:55.
My code keeps failing with error "type mismatch".
Sub Hide_ProjectA()
'
' Hide_ProjectA Macro
' Hides columns outside a specified project date range
'Unhide all columns
Columns("D:BC").Hidden = False 'Unhide all week Columns
'Hides all columns before project A
ActiveSheet.Columns("4:B9").EntireColumn.Hidden = True
'Hides all columns after project A
Columns("B10:55").Hidden = True
Application.ScreenUpdating = True
End Sub
Any help would be great!
Bookmarks