Create Button in selected cell

jrisebo

Active Member
Joined
Mar 15, 2011
Messages
325
Office Version
  1. 365
Platform
  1. Windows
I want someway to select a cell, and then create a button in said cell. I want it to be the same size as the selected cell.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How about more info about what you are trying to achieve?
 
Upvote 0
I want to be able to create 7 different buttons, but have them all be the same size, and all lined up.
 
Upvote 0
Try this for one button in the selected cell

Code:
Sub AddButton()
Dim btn As Object
With ActiveCell
    Set btn = ActiveSheet.Buttons.Add(.Left, .Top, .Width, .Height)
End With
End Sub
 
Upvote 0
Thanks that worked. I just did each cell as needed. Cool!
 
Upvote 0
Thanks that worked. I just did each cell as needed. Cool!
 
Upvote 0
Oops, So how do I now add a if statement to the VBA for the button?

I want to have it check a cell for a condition, then hyperlink to another tab if true, and do nothing if false.

e.g. =IF(anch1="a",HYPERLINK('VII. A Headed studs'!J85)),IF(anch2="b",HYPERLINK('VII. B Headed studs'!J85)),......

Not sure how to finish that.
 
Upvote 0
Are you saying that all you need are formulas to do hyperlinking, and no buttons, in fact?
 
Upvote 0
No, I want there to be a button, so when you press it, it checks the 'if' statements, and then does what it should. Perhaps the buttons can be linked to a cell, instead of VBA where I can do the if statement.
 
Upvote 0
And how does this formula perform?
Code:
=IF(anch1="a",HYPERLINK("#'VII. A Headed studs'!J85","a link"),IF(anch2="b",HYPERLINK(#"'VII. B Headed studs'!J85","b link"),""),"")
that's just an example, as you still haven't described in full what it is you are aiming to do, and so all I can do is guess.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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