Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
EXCEL macro that will vary when copied
I want a "macro button" that acts on one row to be able to be copied in many
other rows(1200), without having to write a new macro for each row. (to Copy-Paste it and have it act the same as an EXCEL formula, changing the relative addresses automatically). In paricular, all the button does is take the cursor "Home" in the same row (leftmost column), insert the digit "1" in that cell and move one column to the right. Any ideas? (I don't speak "Basic"....) |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
EXCEL macro that will vary when copied
Michael
The following will do what you want Sub t() Dim r As Long r = ActiveCell.Row Cells(r, 1) = 1 Cells(r, 2).Select End Sub Copy this into a VB module (ALt + F11) select Insert, Module and paste the macro into the module. Press Ctrl + Q to return to the sheet. I would not use a macro button to execute the macro unless you have Freezed the panes. Instead assign a shortcut key. While in Excel choose Tools, Macros (Alt + F8), click once on the macro to select it if necessary and click the Options Button. Assign the Letter Q, it does not seem to be used for anything and click ok. Press Ctrl + Q to run the code. Peter "Michael52" wrote: I want a "macro button" that acts on one row to be able to be copied in many other rows(1200), without having to write a new macro for each row. (to Copy-Paste it and have it act the same as an EXCEL formula, changing the relative addresses automatically). In paricular, all the button does is take the cursor "Home" in the same row (leftmost column), insert the digit "1" in that cell and move one column to the right. Any ideas? (I don't speak "Basic"....) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I create a macro that will select a range that can vary in | Excel Discussion (Misc queries) | |||
In excel, how do I vary a cell over a data range & see its effect? | Charts and Charting in Excel | |||
vary row colors in excel? | Excel Discussion (Misc queries) | |||
excel should let you vary error bars for individual points | Charts and Charting in Excel | |||
Macro to insert copied cells | Excel Discussion (Misc queries) |