Selection based on a variable

camylarde

Registered User.
Local time
Today, 16:33
Joined
Aug 25, 2010
Messages
11
Hello fellow programmers,

I am fighting with the following problem, that is testing my knowledge onto how to select various cells beyond limits...

I have an excessive macro code that tries to reestablish formatting in a sheet in case users will change it (and they will unforutnately do as part of their work routine).

Part of the sheet is having variable number of columns and I need to be able to accomodate for this in my selections.

Please help me creating this selection code based on a single variable (that Im able to fill with proper index myself)

So, I need first to select all cells in columns P:Q.
Next a range R3:R18 (where 18 is the random example of the total row count in the table - again, i do have a variable for it already and am counting the rows automatically via code)
Next column S (this one is easy, Range("P:Q").offset(0,3).resize(,1).select )
Next cell S2 needs special formatting
Next cells S3:S18 needs formula inserted

If all these selections can be made somehow from the initial pointer to say cell P1, or column P:Q or something that you know will work, I would higly appreciate the hint. I believe i can work it up from there.

Basically i got stuck with creating a fixed range selection by offseting and resizing teh initial column selection, or vice versa.

Thanks for your time and help.
 

Users who are viewing this thread

Back
Top Bottom