+ Reply to Thread
Results 1 to 7 of 7

Error when using FIND Method to find last row when column is blank

  1. #1
    Registered User
    Join Date
    12-02-2012
    Location
    ny,ny
    MS-Off Ver
    Excel 2010
    Posts
    13

    Error when using FIND Method to find last row when column is blank

    Ive been using the following method to find the last row on multiple sheets that contain web queries. The queries contain lists of stock symbols that i filter and move to a master sheet that i then import to my trading application. They all normally work fine, but some days the queries contain no stocks for the day and i receive... "Run-time error'91': Object variable or With block variable not set". Heres the code.....
    Please Login or Register  to view this content.
    Ive tried playing around with 'If NOT lastrow is NOTHING then' and ' IF lastrow is NOTHING then' but couldnt get anything to work. Not even sure if that approach would even work with this kind of problem.Was wondering if there was a way to work around this. Any help would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error when using FIND Method to find last row when column is blank

    You do not have a "Find function" in your code, what you have is to look for the last row in column D
    Please Login or Register  to view this content.
    You can change this to look at the last row in your data, not just in column D. For e.g

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Error when using FIND Method to find last row when column is blank

    try using some error handling

    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Error when using FIND Method to find last row when column is blank

    I think there is something from your code

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    need to go in a cell. Where is the copied range is going? In which column?
    Please Login or Register  to view this content.
    if it go in to column A

  5. #5
    Registered User
    Join Date
    12-02-2012
    Location
    ny,ny
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Error when using FIND Method to find last row when column is blank

    I need to look for last row in column D. The query that is on the sheet is of the entire web page and theres data everywhere on it. The information i need is on one area right in the middle of the page and its the only data on the page thats ever in that column.


    Quote Originally Posted by AB33 View Post
    You do not have a "Find function" in your code, what you have is to look for the last row in column D
    Please Login or Register  to view this content.
    You can change this to look at the last row in your data, not just in column D. For e.g

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-02-2012
    Location
    ny,ny
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Error when using FIND Method to find last row when column is blank

    Thanks. I took your suggestion and this is what ive got and it works perfect.

    Please Login or Register  to view this content.
    Quote Originally Posted by Sean Thomas View Post
    try using some error handling

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-02-2012
    Location
    ny,ny
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Error when using FIND Method to find last row when column is blank

    Im pasting to named ranges on "Import_Ts" sheet.


    Please Login or Register  to view this content.
    Quote Originally Posted by AB33 View Post
    I think there is something from your code

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    need to go in a cell. Where is the copied range is going? In which column?
    Please Login or Register  to view this content.
    if it go in to column A

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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