+ Reply to Thread
Results 1 to 4 of 4

Run-Time Error when Trying to Populate Cells

  1. #1
    Registered User
    Join Date
    10-02-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2010
    Posts
    10

    Run-Time Error when Trying to Populate Cells

    Hello All,

    I am trying to populate cells with a date that is located next to a cell with the word "Visit."

    This is my code:
    Please Login or Register  to view this content.
    I get a run-time error 1004 (Application defined or object defined error) and when I hit "debug" the part in red font is the problem area.
    The weird thing though is when I look at my spreadsheet, the code works. It does what I want. But this code is a small part of a larger macro, so the error causes my macro to stop running. Any and all help is much appreciated!

  2. #2
    Forum Contributor
    Join Date
    02-15-2010
    Location
    Everett, WA
    MS-Off Ver
    All versions; most components
    Posts
    188

    Re: Run-Time Error when Trying to Populate Cells

    Change:
    Please Login or Register  to view this content.
    to:

    Please Login or Register  to view this content.
    You're getting the error because you're trying to run the code on row 0, which doesn't exist. It's appears to be doing what you want because all the other rows are affected before lRow = 0.

  3. #3
    Forum Contributor
    Join Date
    01-17-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2010
    Posts
    211

    Re: Run-Time Error when Trying to Populate Cells

    not sure since we have only part of code and no clue how sheets is populated but put this above the 'red' line
    Please Login or Register  to view this content.
    and let us know what it says , probably zero hence it errors
    If solved remember to mark Thread as solved , to mark your thread as Solved select Thread Tools and click Mark thread as Solved.

    I can't read the mind of my wife so then I get picture but no sound .... and then I mostly get the idea, same goes here picture your outcome and I get the idea.

  4. #4
    Registered User
    Join Date
    10-02-2013
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Run-Time Error when Trying to Populate Cells

    I change "Do While True" to "Do While lRow > 0" and it worked! YAY!! Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 07-06-2013, 10:13 AM
  2. [SOLVED] VBA Excel 2007 : Autofit Merge Cells Error "Run-time error '13': Type Mismatch"
    By Hudas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2012, 04:10 PM
  3. range(cells(),cells()) from 2 different workbooks, run time error 1004
    By sam0287 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2010, 05:46 AM
  4. Run-time error '91' when 'On error goto' and cells.find
    By bjoern in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2008, 07:27 PM
  5. [SOLVED] Run time error when running macro to populate a pivot table
    By Pete Straman Straman via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2005, 01:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1