Hi,
Can somebody please explain to me why I am getting the object variable not set error when I am doing the following code?
Sub HideMonths()
'
' HideMonths Macro
'
Dim myFind As Range
'
Set myFind = Rows(1).Find(What:="1/5/2007", _
After:=Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
Range("C1", myFind.Offset(0, -1)).EntireColumn.Hidden = True
End Sub
I have copied this straight out of the Step by Step Office Excel 2007 Visual Basics for Applications book and no matter how many times I try it I get the same error and it's driving me mad.
Help would be very much appreciated - thx
The code is supposed to hide everything from Column C to the column before the date in the find (in this case column H)
Can somebody please explain to me why I am getting the object variable not set error when I am doing the following code?
Sub HideMonths()
'
' HideMonths Macro
'
Dim myFind As Range
'
Set myFind = Rows(1).Find(What:="1/5/2007", _
After:=Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
Range("C1", myFind.Offset(0, -1)).EntireColumn.Hidden = True
End Sub
I have copied this straight out of the Step by Step Office Excel 2007 Visual Basics for Applications book and no matter how many times I try it I get the same error and it's driving me mad.
Help would be very much appreciated - thx
The code is supposed to hide everything from Column C to the column before the date in the find (in this case column H)