Macro or code to copy a "command button"

johannordgren

New Member
Joined
Apr 24, 2018
Messages
31
As the title says, my need is to copy a made command button to another 500 rows.

The code I'm using is this;

Private Sub CommandButton1_Click()
Dim x As Integer
x = Range("A1").Value
Range("A1").Value = x + 1
End Sub


Which makes a count of how many times the button is clicked.

What i would like is to copy this button, pretty much like you would copa down a normal excel cell. I'm talking about the "draging down".

Essentialy i would like the cells in the formula above (A1) to automaticly change, or if you are smarter than me, which you probably are, make a completely different code.

I dont even know if this is possible, but if it is, please help!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You earlier said "Filter"
Are you now saying you want to "Sort" not "Filter"

Sort and filter are not the same.
 
Upvote 0
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
I got it to work! It was appearantly some other problem with the file, since I had used a template when I made the document.
Problem resolved anyway!

Thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top