Forum Discussion
LesKing
May 05, 2023Brass Contributor
Open a website from within Excel
Hi,
In my Excel workbook I have a number of 'Command' buttons to run macros.
I also have one which I would like to (hopefully) click to access a website (which from outside Excel I access via google using the following: https:/www.xxxx.xx.xx/api/v1 where xxxx is the website name), but I'm not sure that is possible. So my question is, is it possible to use a macro that could open this website from within my Excel workbook, allow me to use it, and then close it to get back to my Excel workbook when I've finished? If it is possible, can someone provide the code that would make this happen. I would be most grateful. If it is not possible, it would be good to know so I don't waste any more time trying to achieve this!!
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Me.Range("c:d")) Is Nothing Then Target.Offset(0, 1).Activate ElseIf Not Intersect(Target, Me.Range("e:e")) Is Nothing Then Target.Offset(1, -2).Activate End If End Sub
As a side note, if you hit the tab key after inputting into Columns C and D and then hit the enter key after inputting into Column E, that would also give you the desired effect.
3 Replies
Sort By
Your macro can use the FollowHyperlink method of ActiveWorkbook to open a website in your default browser. But you'll have to go back to Excel yourself.