Results 1 to 4 of 4

Thread: Excel VBA simple one *RESOLVED*

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904

    Excel VBA simple one *RESOLVED*

    in an Excel VBA macro, I have the statement

    Range("D44").Value = n2

    which works fine until I add a row, at which time the "D44" reference REMAINS "D44" even though the cell I'm targeting has moved down one row.

    So, my question is, is there some way to tie VBA code to cells in a way that lets them track the cells as they do when they are referenced by formulas? That is, if a FORUMLA used "D44" and I added a row, the formula would then use "D45", which is what I want my VBA to do.

    Thanks for any help.
    Last edited by phinds; Jun 5th, 2003 at 07:09 AM.

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    One way could be to assign to targetcell a name and use this name to call it instead of "D44"
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    JUST what I was looking for --- thanks opus

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Great, I could help somebody today, that make this "working"day a success.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width