Using Shape as CommandButton

inactiveUser214710

Board Regular
Joined
Apr 27, 2012
Messages
171
Hi everyone
I have a sort of "shapes" that I would like to use as a commandbutton or togglebutton.
What I would like do is when i click on a certain shape, it recorded in the worksheet and gives its name'shape.
How to do it?
In an attempt I used the code below without success.
I need your help.
thanks advance.
Code:
Sub lançarShape()

Dim rng As Range

Set rng = Worksheets("sheet1").ActiveSheet.Shapes.Range(Array("bancoA1")).Cells(Row.Count, "A").End(xlUp).Offset(1, 0)
rng.Range("u2") = "A1"

End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Not sure I understand what you want, but if you simply want to enter the name of the shape in U2 try
Code:
Sub lançarShape()

Range("u2") = "bancoA1"

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

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