+ Reply to Thread
Results 1 to 2 of 2

Macros and cell selection

  1. #1
    Registered User
    Join Date
    04-26-2007
    Location
    MA
    Posts
    1

    Macros and cell selection

    I record a lot of macros and can go into VB to manipulate them, but a programer I am not. I could really use some programming help right now.

    I'm recording a macro to insert rows into a spreadsheet that is divided into sections. Section 1 runs from (A40:T52) with cell N53 being named SubA (it totals N40:N52). If I insert a row, SubA becomes cell N54 and inserting 2 rows would make it N55. I would like to insert individual rows as needed in the row above SubA (as well as SubB, SubC, SubD, and SubE). I can select SubA and I know the code to insert a row, but I can't figure out how to move up 1 cell without it referencing a specific cell (N52). That works for the first row I insert, but when I insert a second row, it will insert a blank row between data. I'm working on making this as user friendly as possible because the users won't be excel savy. Could anyone help me figure out what goes where the 3 ?'s are below in the lines of code? I would really appreciate the help.
    Please Login or Register  to view this content.
    Thank you,

    Roy
    Last edited by Leith Ross; 05-21-2009 at 05:43 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Macros and cell selection

    Hello royhobbs19,

    Welcome to the Forum!

    Perhaps this will help . This macro is a User Defined Function. It works like a worksheet formula and entered the same way in the cell with an equal "=" sign before it. You only need to include the starting cell. The macro will start summing from that cell to the cell above the macro and display the resulting sum in the cell with contains the macro.
    Please Login or Register  to view this content.
    Adding the Macro
    1. Copy the macro above pressing the keys CTRL+C
    2. Open your workbook
    3. Press the keys ALT+F11 to open the Visual Basic Editor
    4. Press the keys ALT+I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL+V
    7. Make any custom changes to the macro if needed at this time.
    8. Save the Macro by pressing the keys CTRL+S
    9. Press the keys ALT+Q to exit the Editor, and return to Excel.
    Example
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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