I'm trying to have a formula reference certain cells and sheets. Because the sheet and which column it reads from can change, I need to be able to have the user select the range from an input box and then have those ranges print in the cell formula, but I can't figure it out! Here is the relevant part of my code:
Dim TableLabel As Range
Dim RowLabel As Range
Dim ColLabel As Range
Set TableLabel = Application.InputBox("Entire Data Table", Type:=8)
Set RowLabel = Application.InputBox("Select Horizontal Labels", Type:=8)
Set ColLabel = Application.InputBox("Select Vertical Labels", Type:=8)
Dim TableLabel2 As String
Dim RowLabel2 As String
Dim ColLabel2 As String
TableLabel2 = TableLabel
RowLabel2 = RowLabel
ColLabel2 = ColLabel
ActiveCell.Formula = "'=(INDEX(" & TabelLabel2 & ", MATCH($A3," & RowLabel2 & ", 0), MATCH(B$2," & ColLabel2 & ", 0))"
Dim TableLabel As Range
Dim RowLabel As Range
Dim ColLabel As Range
Set TableLabel = Application.InputBox("Entire Data Table", Type:=8)
Set RowLabel = Application.InputBox("Select Horizontal Labels", Type:=8)
Set ColLabel = Application.InputBox("Select Vertical Labels", Type:=8)
Dim TableLabel2 As String
Dim RowLabel2 As String
Dim ColLabel2 As String
TableLabel2 = TableLabel
RowLabel2 = RowLabel
ColLabel2 = ColLabel
ActiveCell.Formula = "'=(INDEX(" & TabelLabel2 & ", MATCH($A3," & RowLabel2 & ", 0), MATCH(B$2," & ColLabel2 & ", 0))"