user1996971
user1996971

Reputation: 543

In VBA, is it possible to select a cell relative to a dynamic range?

Let's say I set 'Rng' as a dynamic range, like ("A" & i) where 'i=2' and i increases by 1 whenever a certain condition is met. At the same time, I also set 'k = 2' and increase k whenever another condition is met. Is it possible to write a command that says 'If.... Then Copy "the cell on the top row of whatever column 'rng.offset(0,k)' happens to be at the moment?"

It would be easy to write this as another Offset command, but if the column and row of Rng is changing, is it possible to write a command that copies the top row of this?

Thanks in advance,

Upvotes: 0

Views: 43

Answers (1)

Nathan_Sav
Nathan_Sav

Reputation: 8531

the cell on the top row would be sheet.cells(1,"k")–

Upvotes: 1

Related Questions