+ Reply to Thread
Results 1 to 4 of 4

How do you use a macro to add an extra line at bottom of excel table

Hybrid View

  1. #1
    Registered User
    Join Date
    02-11-2017
    Location
    Galway, Ireland
    MS-Off Ver
    2007
    Posts
    9

    How do you use a macro to add an extra line at bottom of excel table

    Hello!

    I am new. I have been teaching myself excel, just starting to use macros. I though I could get the macro to record my actions and then it would just repeat back what i had done (that i wouldnt have to write codes/formulas for everything?) I need to practice more...but for now, could i get help with this...

    I'm giving my boss a hand. She needs to keep track of the dates each of her employees does specific training courses. I've set up the attached sheet. Problem is my boss would not be able to adapt any of this or *add rows* when she requires them, so i was hoping to make a button that could do that for her.

    See attached. How can I create a macro that will add a new row and bring the formulas with it but leave column A, C, and D blank?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How do you use a macro to add an extra line at bottom of excel table

    Not enough Detail in your request.

    I am guessing that we are looking at sheet "Record of Training"

    I then have to assume that you are adding a row at the bottom

    When I enter a name in column A then Excel automatically enters the formula in columns B and E, because this is a table.

    As I see it all you need to do is to make sure that if any cell is selected after the last entry then the user is taken to column A ready to insert a new name.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How do you use a macro to add an extra line at bottom of excel table

    Not enough Detail in your request.

    I am guessing that we are looking at sheet "Record of Training"

    I then have to assume that you are adding a row at the bottom

    When I enter a name in column A then Excel automatically enters the formula in columns B and E, because this is a table.

    As I see it all you need to do is to make sure that if any cell is selected after the last entry then the user is taken to column A ready to insert a new name.

    Right Click on the sheet name at the bottom of excel and select view code

    A new window will open, this is the sheet specific macro module

    paste this code in the module and close it.

    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    ' Find the last used row in column A
    LR = Cells(Rows.Count, 1).End(xlUp).Row
    
    'If Selected row is last row and name not entered then select column A
    If Target.Row = LR And Application.CountBlank(Range(Cells(LR, 1), Cells(LR, 5))) = 5 Then Cells(LR, 1).Select
    
    'If Row is after last row the select column A in the first empty row
    If Target.Row > LR Then Cells(LR + 1, 1).Select
    
    End Sub

  4. #4
    Registered User
    Join Date
    02-11-2017
    Location
    Galway, Ireland
    MS-Off Ver
    2007
    Posts
    9

    Re: How do you use a macro to add an extra line at bottom of excel table

    Thank you so much!!

    I will be more specific in any future questions! Thanks for your help. That probably was a piece of cake for you but for me its tough to figure that stuff out so thank you very much

+ 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. Macro to close table with Bottom line
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-15-2014, 03:43 AM
  2. Replies: 2
    Last Post: 07-07-2014, 06:48 PM
  3. Excel 2007 : Bottom Line Getting Cut Off
    By Krisp42 in forum Excel General
    Replies: 4
    Last Post: 06-14-2013, 03:53 PM
  4. New Line at the bottom of a Table
    By CodeEnforcer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2013, 02:27 PM
  5. Excel 2007 : extra cells at bottom going to infinity
    By chakotay2 in forum Excel General
    Replies: 4
    Last Post: 11-06-2008, 01:58 AM
  6. delete extra rows at bottom
    By morgonzola in forum Excel General
    Replies: 4
    Last Post: 02-02-2007, 12:50 AM
  7. [SOLVED] How to remove an extra line added by excel when pasting into notep
    By CoolGuy in forum Excel General
    Replies: 1
    Last Post: 03-02-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