I am trying to create a macro that links a cell from another worksheet (this is stored as a variable called SheetName). The user is prompted with an Input box to select a cell. I would like to have a cell in another worksheet reference to the selected cell.
Here is the relevant code:
Dim WorkRng As Range
Total1 = "Select Total cell"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", Total1, WorkRng.Address, Type:=8)
Worksheets("WorksheetA").Range("C6").formula = "=" & 'SheetName.Name' & "!" & WorkRng.Address
The last line is where I am running into object errors. Any help is greatly appreciated!