The best way to code static column values

JonWhite123

New Member
Joined
Dec 3, 2008
Messages
8
Hello everyone,

I hate to start a new post so many apologies if the answer is there and I've missed it, but...

I need a little help with understanding the best way to code something. I have a spreadsheet with about 30 or so columns on it. My code at the moment references the columns directly as "F" or whatever column I want to look at. Sometimes I filter them, sometimes I delete them. This is all fine until a user of the spreadsheet deletes, or otherwise moves columns around. It's my own fault as I've not been coding long, and kinda rushed straight into it - but I now need to put it right....

Some research I've done says to declare everything in a seperate module as Public Const [variablename] = "F" or something similar. Is this the best way to do it? If so how do I get this module to run and remember the column references across 2 or more modules?

Sometimes i need to reference the column as "F" and other times (like when deleting column ranges) it needs to be F - I guess this would simply be 2 declerations?

Thanks in advance for any help. I just want to check with you clever people so I only have to get this right once!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,215,742
Messages
6,126,611
Members
449,321
Latest member
syzer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top