Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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("D32:D43").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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find a range using code | Excel Worksheet Functions | |||
Code to find code | Excel Discussion (Misc queries) | |||
Find last row code | Excel Discussion (Misc queries) | |||
Find Code | Excel Programming | |||
VBA Code to FIND | Excel Programming |