Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a macro that will select a range that can vary in smokief Excel Discussion (Misc queries) 2 May 3rd 07 08:32 PM
In excel, how do I vary a cell over a data range & see its effect? Bimal Charts and Charting in Excel 1 April 13th 07 02:21 PM
vary row colors in excel? bob the bolder Excel Discussion (Misc queries) 1 July 26th 06 04:34 PM
excel should let you vary error bars for individual points CRC Charts and Charting in Excel 4 July 5th 06 11:52 AM
Macro to insert copied cells [email protected] Excel Discussion (Misc queries) 17 January 18th 06 10:40 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"