+ Reply to Thread
Results 1 to 5 of 5

Find the last cell with text in columns D till H and autofils.

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    3

    Find the last cell with text in columns D till H and autofils.

    Hi i'm kinda new to VBA programing but i need a macro that finds the last cells with text in the columns D to H (they all finish at the same row), and then does an autofill until the cell in column D has #N/A after that deletes the NA cells and stops.

    this is what i have so far:
    Please Login or Register  to view this content.
    it will most likely give an error, but i'm still trying to work on it.

    THNX in advance for anyhelp provided.

  2. #2
    Forum Contributor
    Join Date
    07-05-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2016
    Posts
    165

    Re: Find the last cell with text in columns D till H and autofils.

    This will select the last cell in column D with any data in it as long as there are no blank cells in the column until the end.

    Please Login or Register  to view this content.
    I could do a lot more if you gave me a sample of the workbook or worksheet you would work on.
    Last edited by Xer2; 07-05-2012 at 08:00 PM.

  3. #3
    Registered User
    Join Date
    07-05-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find the last cell with text in columns D till H and autofils.

    thnx your code helped me to get a good start

    and my workbook gets its data from other workbooks so if you try to test it and see an error it may probably be because of that.

    the nš of lines that it copies from the dat files are the exact nš of lines it needs to do the autofill. i think a ".count" propertie should work. i'm tring it now bt to no avail.

    so here you go the workbook: Book3_2.xls

    ***************************************************************

    i edited the code now it selects the last cell and selects the next 4 columns.

    Please Login or Register  to view this content.
    now it just needs to autofill the exact nš of information it copied to sheet 1.
    Last edited by DaCasp; 07-06-2012 at 05:19 AM. Reason: figured out something

  4. #4
    Forum Contributor
    Join Date
    07-05-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2016
    Posts
    165

    Re: Find the last cell with text in columns D till H and autofils.

    I've looked at the code, but as you stated I can't run it, nor can I get data.

    Based on what I've seen, and the assumptions I've made, you need to create a variable that increments as the rows are counted in the loop that copies to Sheet 1, then you can use that variable to know how many rows should auto fill.

    Also, the #N/A is not what text is in the cell. If you try to check it (i.e.- =IF(A1 = "#N/A") it will never come out true. You have to use the =ISERROR(A1) function to check for #N/A.
    Last edited by Xer2; 07-06-2012 at 11:31 AM.

  5. #5
    Registered User
    Join Date
    07-05-2012
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Find the last cell with text in columns D till H and autofils.

    i see. Thnx your advices have been very helpfull. sorry for the late answer i was away from a computer. and i'll try the variable and the function for the error. Thnx again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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