Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default What in the edited code below makes it crash?????

if you do not find the word latest then it will crash...

Cells.Find("latest").Select

When you do a find you really need to specify the optional paramters,
otherwise whatever the user left them at last will be used...

dim rngFound as range

set rngfound = cells.find(what:="latest", LookAt:=xlpart,
lookin:=xlformulas, matchcase:=false)

if rngfound is nothing then
msgbox "latest was not found"
else
rngfound.select
endif
--
HTH...

Jim Thomlinson


"Simon" wrote:

Current code:

MyWBSEL.Activate
Sheets("Elite").Select
Range("G4").Select
Selection.End(xlDown).Select
Application.CutCopyMode = False
Selection.Copy
MyWBAccRep.Activate
Cells.Find("latest").Select
ActiveCell.Offset(21, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Edited:

MyWBSEL.Sheets("Elite").Range("G4")..End(xlDown).C opy Destination:=
MyWBAccRep.Cells.Find("latest").Cell.Offset(21, 0)



The edited code crashes. Why? The workbooks are Dim'd and Set and
opened.

Reply
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
What in the edited code below makes it crash????? Don Guillett Excel Programming 0 August 13th 08 03:14 PM
Simple code makes Excel 2007 crash Mathieu[_2_] Excel Programming 6 April 10th 08 09:56 AM
this code makes excel crash zz Excel Programming 0 December 22nd 06 11:14 PM
XLA makes XL2003 crash Soren[_2_] Excel Programming 3 September 27th 05 01:40 PM
XLA makes XL2003 crash Soren[_2_] Excel Programming 0 September 26th 05 09:31 AM


All times are GMT +1. The time now is 02:59 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"