Assign 2 actions to a userform command button

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
Becoming a regular on here lately!

Okay, so I have cell D15 that a user selects a web address from a dropdown list, and clicks the Command button to be taken to that website.
I need the selection to go back to default after the the button is clicked and the user is taken to the website.
D15 has "Select..." displayed as default, and I need it to go back to displaying this once the button is clicked.

Code:
Private Sub CommandButton4_Click()ActiveWorkbook.FollowHyperlink Address:="http://" & Range("D15").Value, NewWindow:=True
End Sub

I've tried adding 'Then' and what-not, but not getting anywhere...

Code:
Range("D15").Value, "Select..."
? somewhere, somehow?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
.
Try this :

Code:
Option Explicit


Sub ResetDropdown()
    Sheets("Sheet1").Range("K2").Value = "My Value"
'possible pause in code here so website can load ?
    Sheets("Sheet1").Range("H2").Value = "Select ..."
End Sub


Change cell references to match.
 
Upvote 0

Forum statistics

Threads
1,224,846
Messages
6,181,305
Members
453,031
Latest member
Chris_1

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