HOW CAN I RECORD A MACRO AND FILL THE DOWN A SHEET LIKE A FORMALA

N

NME

CAN U RECORD A MACRO ASSIGN TO A BUTTON AND CUT AND PASTE IT TO A DIFFERANT ROW
IE: THE MACRO IS ASSIGNED TO A BUTTON NEXT TO A4
THE MACRO COPYS A1 TO A2
I WANT TO COPY THIS MACRO TO A BUTTON NEXT TO B4 AND THE MACRO WILL COPY B1
TO B2 (LIKE USING THE FILL DOWN TO COPY A FORMULA)
 
G

Guest

hi,
you can't copy and paste macros. At least like i think you
are asking.
you will have to record a new macro and assign it to a new
button.
 
S

swatsp0p

First, please don't use all caps in your posts, as it is considered rude
(like shouting). Thank you.

Second, your request can be accomplished by using the Visual Basic Editor
(Alt+F11 to open). In the upper left pane of the VBA editor, locate the
VBAProject that contains your buttons (expand the '+' if needed). Double
click on Sheet1 (or whichever sheet has your buttons). In the pane to the
right, click on the Down Arrow of the left hand box (General) and click on
the CommandButton1 item. This will open the macro you have assigned to this
button. Highlight the portion of the command you wish to copy, press Ctrl+C.
Next click on CommandButton2 in the dropdown box and paste your script
between the "Private..." and the "End Sub" lines. Edit this macro so that
references to "A1" and "A2" say "B1 and "B2".

Hope this helps.
 
V

VENKAT

slightly modify the macro using vba language and give row no. or cell as
inputbox. type this code in vbeditor (alt+F11. remove xxxx from my email
address.

Option Explicit
Public Sub test()
Dim cell As Range
Set cell = Range(InputBox("type the cell address for example a1 or A2 etc.
and click ok"))
cell.Offset(0, 1) = cell
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top