0
Myvar:=5
F1::
xl:=comobjactive("excel.application")
xl.range("i"myvar).select()
myvar++
Send, {CTRLDOWN}v{CTRLUP}
return

In the above script, when I press F1 key it selects I5 cell automatically and pastes the copied data there.

Here the problem is that if I5 cell is not blank it pastes the data on that and the cell is over written. I want that if I5 cell is not blank then it should move to the next cell i.e. I6 and should paste the data there. And if I6 is not blank then it should move to I7, namely it should paste the data in the next blank cell only. It should skip the cells in which there are already some values. Is it possible?

1 Answer 1

0

You simply need to add a conditional statement to check if range is blank.

Myvar:=5
F1::
xl:=comobjactive("excel.application")
While (xl.range("i" . myvar).Value <> "") {
  myvar++
} 
xl.range("i" . myvar).select()
myvar++
Send, {CTRLDOWN}v{CTRLUP}
return

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .