ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   relative ref. macro (https://www.excelbanter.com/excel-programming/272848-re-relative-ref-macro.html)

J.E. McGimpsey

relative ref. macro
 
Recording macros can get you only so far, unfortunately...

Assume you want to copy the selected cell(s) five rows down. One way
is:

Public Sub Copy5RowsDown()
With Selection
.Copy Destination:=.Offset(5, 0)
End With
End Sub




In article ,
"Milton" wrote:

I want to copy several cells to new locations in the same
spreadsheet, using a macro in relative mode. When I
click on the Relative Reference Button on the Stop
Recording Toolbar the button shows as "relative" only as
long as the cursor is pointing to it. Then when I do the
copy/paste function only the first copy is relative and
all following copy/paste events are absolete. Also the
relative function works for only one cell, if several
cells are selected the copy is absolute mode even if the
relative reference button was pressed.
Any help will be appreciated.



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

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