+ Reply to Thread
Results 1 to 6 of 6

How to identify the Last row automatically while running a macro ?

  1. #1
    Registered User
    Join Date
    06-26-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    81

    How to identify the Last row automatically while running a macro ?

    Hi all,
    Hope everything is good.

    I just recorded a macro and I need help from you guys in editing this program.

    Steps that are followed:
    1) Insert a new column beside (Just for my convenience, I call the new column name as Temp column) Column B.
    2) Use "TRIM" command.
    3) Drag it till the end of the row.
    4) Paste the obtained result as Values.
    5) Again Insert new column just right side of Temp column.
    6) Use "LEFT" command (Number of characters taken as 6).
    7) Drag it till the end of the row.
    8) Paste the obtained result as Values.
    9) Delete 'A' column & Temp column.

    My Requirement is, last row number (Here, the last row is 355 but it will change everytime) will be changing everytime and I want that to be identified automatically and perform the above steps that are mentioned.

    Can anyone help me on this ? Thank you for your patience in reading this request.

    Recorded Macro:
    Please Login or Register  to view this content.
    Thank you in advance.
    Raju
    Last edited by 6StringJazzer; 07-13-2017 at 10:38 AM.

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    15,034

    Re: How to identify the Last row automatically while running a macro ?

    Hi Raju

    please be so kind and upload a sample file with a before/after scenario so that we can ascertain your requirements.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,234

    Re: How to identify the Last row automatically while running a macro ?

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: How to identify the Last row automatically while running a macro ?

    Hi,

    The last row occupied row in a column (B in your example) can be determined as follows

    Please Login or Register  to view this content.
    You can then insert that into your code....

    for example this,
    Please Login or Register  to view this content.
    becomes this
    Please Login or Register  to view this content.
    Note - please edit your post so the the code is presented properly (between tags) - how to do this is described in the site rules.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to identify the Last row automatically while running a macro ?

    Maybe:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-26-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    81

    Solved: How to identify the Last row automatically while running a macro ?

    Hi All,

    First of all I am really sorry for not following the rules that are mentioned.

    And I am really thankful to all of you in guiding me to get the result based on my requirement.
    Thanks a lot!!!!

+ 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. Automatically running a macro
    By nelson.matt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2012, 11:28 AM
  2. Macro for automatically identify redundant data and remove it
    By pyol17 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2012, 04:48 AM
  3. running a macro automatically
    By gbWildy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2007, 03:16 PM
  4. Running a macro automatically
    By alex1982 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2007, 09:48 AM
  5. [SOLVED] Running a Macro automatically
    By davemel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2006, 06:15 PM
  6. automatically running a macro
    By 42410 in forum Excel General
    Replies: 2
    Last Post: 04-26-2005, 11:06 AM
  7. [SOLVED] automatically running a macro
    By 42410 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2005, 11:06 AM

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