Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a spreadsheet that consists of 2 tabs with around 35 columns and 20 columns respectively. Throughout the code I am updating fields in the column. The developer that originally created the spreadsheet uses the actual column number in the code reference when updating a field which makes it difficult to know which field you're updating when you're looking at the code.. Is there a best practice around this? What I would like to do is create public variables that contain meaningful names with the column number indicated there and use the variable name throughout the code when a field is updated. For example:
Declare the following as public variables: SHEET1_FirstName = 1 'column number for FirstName column on SHEET1 SHEET1_LastName = 2 'column number for LastName column on SHEET1 I can then use the variables when I need to make an update: Sheets("SHEET1").Cells(l_Row, SHEET1_FirstName) Is there a best practice around this and how much overhead is added by using this convention? This makes it easier to add or remove columns as well. Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Public Variables | Excel Programming | |||
Public Variables | Excel Programming | |||
Public variables | Excel Programming | |||
Public Variables | Excel Programming | |||
Public Variables | Excel Programming |