S
Simon
I use the following code to open an excel file and then
paste a summarised extract from one sheet (data) into
another (amp) on a daily basis. The place it pastes the
extract is dependent on the date of the file extract and
I use the Cells Find to locate the date within the sheet
where I want to paste the data.
'get summary data
Sheets("summary").Select
Range("D3243").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("amp").Select
'find the cell with the date as header
Cells.Find(What:=ActiveCell.Value, After:=ActiveCell,
LookIn:=xlValues,
LookAt:=xlPart,SearchOrder:=xlByRows,
SearchDirection:=xlNext,MatchCase:=False).Activate
Selection.Offset(1, 0).Select
'move down one
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
'paste data
Until recently the routine has worked fine, but now trips
up at 'Cells Find' with the error message "Runtime error
91 - Object variable or Block variable not set".
It was working fine up to 10/09, but falls over with
10/10 and subsequent day's data. Is there a constraint
with date formats that I've missed or can anybody suggest
how I should amend my code to fix this?
Any help gratefully received.
Thanks Simon
paste a summarised extract from one sheet (data) into
another (amp) on a daily basis. The place it pastes the
extract is dependent on the date of the file extract and
I use the Cells Find to locate the date within the sheet
where I want to paste the data.
'get summary data
Sheets("summary").Select
Range("D3243").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("amp").Select
'find the cell with the date as header
Cells.Find(What:=ActiveCell.Value, After:=ActiveCell,
LookIn:=xlValues,
LookAt:=xlPart,SearchOrder:=xlByRows,
SearchDirection:=xlNext,MatchCase:=False).Activate
Selection.Offset(1, 0).Select
'move down one
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
'paste data
Until recently the routine has worked fine, but now trips
up at 'Cells Find' with the error message "Runtime error
91 - Object variable or Block variable not set".
It was working fine up to 10/09, but falls over with
10/10 and subsequent day's data. Is there a constraint
with date formats that I've missed or can anybody suggest
how I should amend my code to fix this?
Any help gratefully received.
Thanks Simon