ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to be used in any cell (https://www.excelbanter.com/excel-discussion-misc-queries/111232-macro-used-any-cell.html)

Diane

Macro to be used in any cell
 
How do I make a macro available in any cell of a worksheet.
I created it in a cell, but I want to be able to use it in any cell. Thanks.

Range("L1058").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"..\..\..\Customer Filing\"
Range("L1058").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Range("C1").Select
Application.CommandBars("Stop Recording").Visible = True
End Sub

Trevor Shuttleworth

Macro to be used in any cell
 
Try reducing it to just:

ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="..\..\..\Customer Filing\"
Selection.Hyperlinks(1).Follow _
NewWindow:=False, AddHistory:=True

Regards

Trevor


"Diane" wrote in message
...
How do I make a macro available in any cell of a worksheet.
I created it in a cell, but I want to be able to use it in any cell.
Thanks.

Range("L1058").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"..\..\..\Customer Filing\"
Range("L1058").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Range("C1").Select
Application.CommandBars("Stop Recording").Visible = True
End Sub





All times are GMT +1. The time now is 06:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com