ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Recording macros....record cursor movement not cell address? (https://www.excelbanter.com/excel-programming/365108-recording-macros-record-cursor-movement-not-cell-address.html)

tim m

Recording macros....record cursor movement not cell address?
 
Greetings, Just recording a macro to insert a column in the middle of some
data, enter a formula and then copy the formula to cells below (having some
problems with blank rows screwing this up but I'll leave that for another
question). The number of rows in this data will vary, the recorded macro
looks at what cell I move cursor to rather than just going right one cell or
end down. How can I get around this, do I have to record the macro and then
manually edit it to move one cell to right or end down where it has selected
a cell address?

Thanks.

Mike Gallagher[_2_]

Recording macros....record cursor movement not cell address?
 
Tim,
Have you tried SendKeys
ex
'the following is the same as pressing the down arrow 1 time:
SendKeys "{DOWN}", True
'the following is the same as pressing the down arrow 11 times:
SendKeys "{DOWN 11}", True
'the following will go to the last used cell in the current selected column:
SendKeys "^{END}", True

regards
Mike

"tim m" wrote:

Greetings, Just recording a macro to insert a column in the middle of some
data, enter a formula and then copy the formula to cells below (having some
problems with blank rows screwing this up but I'll leave that for another
question). The number of rows in this data will vary, the recorded macro
looks at what cell I move cursor to rather than just going right one cell or
end down. How can I get around this, do I have to record the macro and then
manually edit it to move one cell to right or end down where it has selected
a cell address?

Thanks.


tim m

Recording macros....record cursor movement not cell address?
 
No I haven't tried those, I assume I would record the macro as I had been
doing and then edit it to take out the cell references in there and insert
the send keys lines of code. I'll read up on SendKeys.

Thanks!

"Mike Gallagher" wrote:

Tim,
Have you tried SendKeys
ex
'the following is the same as pressing the down arrow 1 time:
SendKeys "{DOWN}", True
'the following is the same as pressing the down arrow 11 times:
SendKeys "{DOWN 11}", True
'the following will go to the last used cell in the current selected column:
SendKeys "^{END}", True

regards
Mike

"tim m" wrote:

Greetings, Just recording a macro to insert a column in the middle of some
data, enter a formula and then copy the formula to cells below (having some
problems with blank rows screwing this up but I'll leave that for another
question). The number of rows in this data will vary, the recorded macro
looks at what cell I move cursor to rather than just going right one cell or
end down. How can I get around this, do I have to record the macro and then
manually edit it to move one cell to right or end down where it has selected
a cell address?

Thanks.



All times are GMT +1. The time now is 10:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com