Hi friends,
i have to update 'summary' sheet by searching date in 'data' sheet and selecting certain cells below searched date. i wrote below code to do same, but i'm getting "Run-time error '91': Object variable or with block variable not set " for below code.
My search date text will always be in merged cells. (think this is the reason for error)
Please help me to correct it..
The full code i written is;
i have to update 'summary' sheet by searching date in 'data' sheet and selecting certain cells below searched date. i wrote below code to do same, but i'm getting "Run-time error '91': Object variable or with block variable not set " for below code.
My search date text will always be in merged cells. (think this is the reason for error)
Code:
Cells.Find(What:=Find, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Please help me to correct it..
The full code i written is;
Code:
Sub Update()
Dim Find As String
Dim Start As Range
Dim Last As Range
Sheets("Summary").Select
If Range("A3").End(xlToRight) <> Date Then
Do Until ActiveCell = Date
Set Start = Range("A3").End(xlToRight)
Set Last = Start.Offset(0, 1)
Start.AutoFill Destination:=Range(Start, Last), Type:=xlFillDefault
Range("A3").End(xlToRight).Select
Loop
End If
Range("A4").End(xlToRight).Offset(0, 1).Select
Do Until ActiveCell.Offset(-1, 0) = ""
Find = ActiveCell.Offset(-1, 0).Value
Sheets("Data").Select
Cells.Find(What:=Find, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 2).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Summary").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A4").End(xlToRight).Offset(0, 1).Select
Loop
End Sub