简体   繁体   中英

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,

最上面一行的单元格是sheet.cells(1,“ k”)–

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM