-
Solved: Run time error 91: Object variable or with block variable not set
[VBA]
Public Sub insertMonth()
Dim Month As String
Dim Answer As range
Dim newAnswer As Date
Dim x As range
GetMonth:
Month = inputbox("Input your Month, example 09/2010:")
If Month = "" Then
GoTo GetMonth
Else
Set Answer = Rows(9).find(What:=Month, After:=Rows(9).Cells(1, 1) _
, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
End If
If Answer Is Nothing Then
MsgBox "Month Not Found"
Else:
newAnswer = CDate(Answer)
Workbooks("bbca volume report 2010_may_team.xls").Activate
Sheets("CS-EB 2010").Activate
x = Application.Match(newAnswer, Workbooks("bbca volume report 2010_may_team.xls").Worksheets("CS-EB 2010").range("A1:A1000"), 0)
MsgBox x
End If
End Sub
[/VBA]
I have error with the sentence in bold.Need help urgently and appreciate all helps. Thanks.
-
object variable x has been Dimmed as a range when Match returns a number (a Double here).
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules