Consulting

Results 1 to 3 of 3

Thread: Catering for columns that will move

  1. #1
    VBAX Regular
    Joined
    Dec 2007
    Posts
    78
    Location

    Catering for columns that will move

    Nothing to do with my post on macros and buttons...this one is more general. One thing I find annoying is coding based on an original idea for the sheet format and having to recode when I insert/ delete rows and columns.

    Can I prevent this by referring to the title rows and columns of a spreadsheet as a range_name.

    E.g. a column headed Total Points on the right of a championship table. If the same macro that works out the points every year is used but the number of events change (so the Total Points column will move left or right). Can I refer to the Total Points column header as the range name "Total_points" and use that as a reference in the code, so I don't have to adjust the cell references.

    Thanks

  2. #2
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    273
    Location
    you sould be able to use the names proporty of a workbook to find the correct group of cells, or, if the header stays in the same row you could scan the row looking for the right header, and use that to locat the corecet group of cells.

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Add defined names.

    See http://www.xldynamic.com/source/xld.Names.html
    Names In Excel - A Discussion
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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