+ Reply to Thread
Results 1 to 6 of 6

Macro to add cell below to activecell

  1. #1
    Registered User
    Join Date
    03-07-2008
    Posts
    5

    Macro to add cell below to activecell

    Hi, thanks in advance for reading this. Our office recently moved from WordPerfect and Lotus to Office 2003 (bought on sale since Office 2007 was released). I want to start using Excel right away because of some of its features, but am having trouble with macros - I'm not a VBA programmer, and even when I think I've got it right I end up messing it up. The main macro I want to convert is so simple it's probably silly. In my worksheet there are two rows: row 1 has a value of 20, row 2 has a value of 1.30 . I want the value in row 1 to be 21.30 and row 2 to be deleted. There are multiple instances of this in the worksheet. I would highlight the cell in row 1, and the macro in Lotus was:

    21.3~{D}/wdr~

    I seem to be having a problem with relative locations. It always ends up NOT changing the value to 21.3 and instead deletes each row.

    Any help I can get is appreciated - thanks again!

    Mike

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    03-07-2008
    Posts
    5
    VBA Noob, thanks for the quick response! That works very well, but is there a way to get it to drop down to the row where the cell is now empty and delete the entire row?

    Thanks!

    Mike

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Registered User
    Join Date
    03-07-2008
    Posts
    5

    Even better!

    This is even better! I occasionally get multiples of 21.30 (42.60, 63.90) that I always did by hand, this works for all of them! My main frustration was "moving the cursor" in the macro. Lotus was simply DOWN, UP, LEFT, RIGHT. I see here, after you dimensioned rng for the macro, that you used the "Rng.Offset(1) " command. If the offset was (-1) would that be the row directly above? How about moving left and right, what would I have used to go left one column?

    Thanks a bunch!

    Mike

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    No problem

    Yes. -1 would be the cell above. Note if you have a cell in Row 1 it will return a error

    Light may help you

    http://j-walk.com/ss/excel/tips/tip20.htm

    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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