ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   next cell in a macro (https://www.excelbanter.com/excel-discussion-misc-queries/158728-next-cell-macro.html)

Pa Maher

next cell in a macro
 
An excell spreadsheet works as a master log of forms completed over a period
of time.
A macro opens the master log, finds the next empty cell in a column and
copies a cell of information to the cell in the other workbook. This part
works fine.
It then needs to go to the next cell on the left and copy an additional
information from the form workbook. When I use the "record a macro" it
inserts the absolute cell name (say G2) rather than a relative address (i.e.,
move one cell to the left). What statement should I use?


Jim Thomlinson

next cell in a macro
 
Assuming you are using the active cell then

ActiveCell.Offset(0, -1).Select

FYI when you ask a code question post your code or at least a snippet so
that we can see what you are up to. It makes answering a lot easier and more
precise.
--
HTH...

Jim Thomlinson


"Pa Maher" wrote:

An excell spreadsheet works as a master log of forms completed over a period
of time.
A macro opens the master log, finds the next empty cell in a column and
copies a cell of information to the cell in the other workbook. This part
works fine.
It then needs to go to the next cell on the left and copy an additional
information from the form workbook. When I use the "record a macro" it
inserts the absolute cell name (say G2) rather than a relative address (i.e.,
move one cell to the left). What statement should I use?


Jim Rech

next cell in a macro
 
The 'cell to the left' of the active cell is referred to as
ActiveCell.Offset(0,-1) programmatically.

--
Jim
"Pa Maher" wrote in message
...
| An excell spreadsheet works as a master log of forms completed over a
period
| of time.
| A macro opens the master log, finds the next empty cell in a column and
| copies a cell of information to the cell in the other workbook. This part
| works fine.
| It then needs to go to the next cell on the left and copy an additional
| information from the form workbook. When I use the "record a macro" it
| inserts the absolute cell name (say G2) rather than a relative address
(i.e.,
| move one cell to the left). What statement should I use?
|



Kevin B

next cell in a macro
 
After you turn macro record on, right click on any toolbar and display the
STOP RECORDING toolbar. The second button (of 2 to choose from) toggles
Abslolue/Relative record. Set it to record relatively.
--
Kevin Backmann


"Pa Maher" wrote:

An excell spreadsheet works as a master log of forms completed over a period
of time.
A macro opens the master log, finds the next empty cell in a column and
copies a cell of information to the cell in the other workbook. This part
works fine.
It then needs to go to the next cell on the left and copy an additional
information from the form workbook. When I use the "record a macro" it
inserts the absolute cell name (say G2) rather than a relative address (i.e.,
move one cell to the left). What statement should I use?



All times are GMT +1. The time now is 05:15 PM.

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