473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Macro wont play

1
Hi Guys

I am a beginner in VBA but am having a problem. The code below steps through ok, yet when I hit play it errors on the object line and I dont understand why (run time 91). There is a worksheet function off this which returns now() as a time stamp, but I dont get why this doesnt step through

Expand|Select|Wrap|Line Numbers
  1.  
  2. Sub ReplaceEvareEscrow()
  3.  
  4. Dim lngrow As Long
  5.   Dim Account As String
  6.   Dim Update As Long
  7.   Dim Rngfound As Range
  8.   Dim Rngsearch As Range
  9.   Dim Evare As Range
  10.  
  11.   Set Rngsearch = Sheets("Data").Columns("B:C")
  12.  
  13.   With Sheets("Evare")
  14.  
  15.     lngrow = 2
  16.     Do Until .Cells(lngrow, 1) = Empty
  17.  
  18.       Account = .Cells(lngrow, 1)
  19.       Update = .Cells(lngrow, 5)
  20.  
  21.  
  22.       Set Rngfound = Rngsearch.Find(What:=Account, LookAt:=xlWhole, MatchByte:=False)
  23.  
  24.      With Rngfound
  25.         .Offset(0, 2).Value = Update
  26.      End With
  27.  
  28.     lngrow = lngrow + 1
  29.  
  30.     Loop
  31.  
  32.   End With
  33.  
  34. End Sub
  35.  
  36.  

Any help is appreciated

Mike
May 22 '07 #1
1 999
danp129
323 Expert 256MB
Please be more clear when stating where you're getting the error. Anyhow, if your code doesn't find a match for the account then Rngfound will be nothing, and Nothing doesn't have any properties or methods, it really is nothing :) Try this:

Expand|Select|Wrap|Line Numbers
  1.  If Not Rngfound Is Nothing Then
  2.      With Rngfound
  3.         .Offset(0, 2).Value = Update
  4.      End With
  5.  End If
Also, if you only have one cell to update I wouldn't bother using With, just use Rngfound.Offset(0,2).Value=Update
May 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Keith Austin | last post by:
I need to produce a macro for a project that I have to do in my course in IT "Certificate III IT (Software Applications) Unit ICAITUO18C". The macro needs to validate previously imported data from...
1
by: jparker | last post by:
I have been working with ASP classic on this current project im involved in. Well the problem im facing now is there is a page where a flash movie should play in a particular section on the page...
1
by: ollyculverhouse | last post by:
Hi, I have a custom menubar which lets users jump to useful forms in my database. For example if I first open a form called 'Add Individual' then another called 'Add Firm', if i try opening...
2
by: dis_is_eagle | last post by:
Hi.If I define a macro which contains a variable declaration,then during expansion the declaration will not be placed at the beginning of the program,but somwhere within it.How can I overcome it? ...
37
by: junky_fellow | last post by:
hi guys, Can you please suggest that in what cases should a macro be preferred over inline function and viceversa ? Is there any case where using a macro will be more efficient as compared to...
20
by: rkk | last post by:
Hi, Is there an equivalent typeof macro/method to determine the type of a variable in runtime & most importantly that works well with most known C compilers? gcc compiler supports typeof()...
8
by: junjiec | last post by:
Hi, Please tell me how could I have a #$B!J(Bsharp sign) expanded in the macro such as #define INCLUDE(filename) #include <filename> which could do the expand below to include a file...
19
by: Tor Rustad | last post by:
I'm implementing a parser, where there is a lot of different data elements defined. Now instead of hand-coding X defines, and the massive number of lines needed for table initialization, I decided...
3
by: lfcII | last post by:
youtube wont't play told me javescript wasn't running ???
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.