LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA code 'find next'

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find a range using code Jonathan Brown Excel Worksheet Functions 3 October 1st 08 12:02 PM
Code to find code D. Excel Discussion (Misc queries) 2 August 12th 07 06:16 PM
Find last row code Mike Milmoe Excel Discussion (Misc queries) 2 June 11th 07 08:48 PM
Find Code Bob Phillips[_5_] Excel Programming 0 July 25th 03 01:53 PM
VBA Code to FIND Christine[_4_] Excel Programming 3 July 17th 03 08:24 PM


All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"