+ Reply to Thread
Results 1 to 4 of 4

The macro does not define the last row in column A

  1. #1
    Registered User
    Join Date
    11-21-2018
    Location
    Moscow
    MS-Off Ver
    Excel2013
    Posts
    5

    The macro does not define the last row in column A

    Hello.
    Help me solve the problem.

    The macro does not define the last row in column A.
    Text from a file 1.txt is inserted only once.

    How to add text from the last line each time the macro is enabled?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: The macro does not define the last row in column A

    Change the last line in your code to
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,622

    Re: The macro does not define the last row in column A

    Using GOTO to exit out of a loop is a NO-NO
    Using GOTO to jump into a loop is a NO-NO

    Please Login or Register  to view this content.
    edit:
    you have a line at the top of the code:
    LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
    that initializes the "Lastrow" variable; however, note that the line:
    ActiveSheet.Range(Cells(LastRow + 1, 1), Cells(UBound(meData), 1)) = Application.Transpose(meData)
    will never change the value of LastRow. That's why I moved the line inside the first DO loop so that it recalculates with each loop iteration.
    Last edited by protonLeah; 11-22-2018 at 02:24 AM. Reason: added information
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    11-21-2018
    Location
    Moscow
    MS-Off Ver
    Excel2013
    Posts
    5

    Re: The macro does not define the last row in column A

    Thank you all for the answers.

+ 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. [SOLVED] Getting compile error user-define type not define
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-07-2015, 07:22 AM
  2. [SOLVED] Define variable in macro than calling that macro inside another macro
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2015, 10:58 AM
  3. keep getting a application define or object define runtime error
    By JRJLHJ1823 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2015, 08:55 PM
  4. [SOLVED] Define Variable as Last Column
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-02-2013, 03:52 PM
  5. error 1004 application define or object define
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2011, 04:09 AM
  6. Define named range where user can define size
    By nahousto in forum Excel General
    Replies: 4
    Last Post: 07-06-2009, 05:09 PM
  7. How do I define column C so C(n) =A(n)+B(n)
    By S M Raucher in forum Excel General
    Replies: 2
    Last Post: 01-10-2005, 01:06 PM

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