+ Reply to Thread
Results 1 to 5 of 5

Updating VB Code

  1. #1
    Adam
    Guest

    Updating VB Code

    Is there any way to automatically update the VB code when you add/delete
    rows/columns in the worksheets or do I need to change all the Range("Cell")
    inputs that are affected by this change?

  2. #2
    Tom Ogilvy
    Guest

    Re: Updating VB Code

    If "Cell" is a defined name, then you shouldn't have to make any changes in
    the code.

    --
    Regards,
    Tom Ogilvy

    "Adam" <[email protected]> wrote in message
    news:[email protected]...
    > Is there any way to automatically update the VB code when you add/delete
    > rows/columns in the worksheets or do I need to change all the

    Range("Cell")
    > inputs that are affected by this change?




  3. #3
    Bob Phillips
    Guest

    Re: Updating VB Code

    You need to ensure that your code caters for however many rows there may be,
    be it by using named ranges, maybe dynamic named ranges, or determining at
    run time how many rows/columns there are.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Adam" <[email protected]> wrote in message
    news:[email protected]...
    > Is there any way to automatically update the VB code when you add/delete
    > rows/columns in the worksheets or do I need to change all the

    Range("Cell")
    > inputs that are affected by this change?




  4. #4
    Adam
    Guest

    Re: Updating VB Code

    In this case the code is created by a recorded macro, hence the code is e.g.
    Range("C12") etc. I realize that this is what creates the problem since it
    does not update to Range("C13") when I add one row in the worksheet. Is there
    a way around this.?

    "Tom Ogilvy" skrev:

    > If "Cell" is a defined name, then you shouldn't have to make any changes in
    > the code.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Adam" <[email protected]> wrote in message
    > news:[email protected]...
    > > Is there any way to automatically update the VB code when you add/delete
    > > rows/columns in the worksheets or do I need to change all the

    > Range("Cell")
    > > inputs that are affected by this change?

    >
    >
    >


  5. #5
    Tom Ogilvy
    Guest

    Re: Updating VB Code

    select C12. In the name box type CellC (as an example). (or use
    Insert=>Name=>Define, Name: CellC, RefersTo: =Sheet1!$C$12)

    In the recorded code, replace
    Range("C12")
    with

    Range("CellC")

    --
    Regards,
    Tom Ogilvy

    "Adam" <[email protected]> wrote in message
    news:[email protected]...
    > In this case the code is created by a recorded macro, hence the code is

    e.g.
    > Range("C12") etc. I realize that this is what creates the problem since it
    > does not update to Range("C13") when I add one row in the worksheet. Is

    there
    > a way around this.?
    >
    > "Tom Ogilvy" skrev:
    >
    > > If "Cell" is a defined name, then you shouldn't have to make any changes

    in
    > > the code.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Adam" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Is there any way to automatically update the VB code when you

    add/delete
    > > > rows/columns in the worksheets or do I need to change all the

    > > Range("Cell")
    > > > inputs that are affected by this change?

    > >
    > >
    > >




+ 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