Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 150
Default VB Code Problem

I have the following code and it works fine unless it can't find a row
containing the text "Open Time". I recieve the error message "Object
variable or With block variable not set. I would like to code to ignore this
section if it can't find the text "Open Time" and move onto the next section
of code. Can someone tell me how I can do this? Many thanks!


Sub FindMacro1()

Dim rng As Range
Cells(1, 1).Select
Set rng = Range("A1:IV65400").Find(what:="Open Time", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
Range(rng, rng.End(xlToRight)).Cut
ActiveCell.End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Select
ActiveCell.End(xlUp).Offset(-1, 0).Select
Selection.EntireRow.Delete

 
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
XLS to CSV Code Problem carl Excel Worksheet Functions 0 March 28th 07 01:21 AM
Strange problem with Code PH NEWS Excel Worksheet Functions 1 September 27th 06 10:16 AM
Little problem with this code... simonsmith Excel Discussion (Misc queries) 11 May 21st 06 04:02 AM
Can anyone figure this code problem please simonsmith Excel Discussion (Misc queries) 1 May 18th 06 08:20 PM
Problem with criteria when using it from VBA Code Alvaro Silva Excel Worksheet Functions 0 December 15th 05 12:25 AM


All times are GMT +1. The time now is 10:57 AM.

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

About Us

"It's about Microsoft Excel"