K
KDJ
Hello
The following code is supposed to always reference the same cell in the
previous worksheet. Unfortunately, I can't figure out the sheet name with the
index number for the previous sheet. The line
ActiveCell.FormulaR1C1 = "=Sheets(x-1)!RC+2"
doesn't work.
Any suggestions?
Dim WeekStep As Integer
Dim TotalSheets As Integer
Dim x As Integer
WeekStep = InputBox("Number of weeks per worksheet:")
TotalSheets = InputBox("Number of Worksheets:")
For x = 2 To TotalSheets
Sheets(x).Select
Range("A5").Select
ActiveCell.FormulaR1C1 = "=Sheets(x-1)!RC+2"
Next x
The following code is supposed to always reference the same cell in the
previous worksheet. Unfortunately, I can't figure out the sheet name with the
index number for the previous sheet. The line
ActiveCell.FormulaR1C1 = "=Sheets(x-1)!RC+2"
doesn't work.
Any suggestions?
Dim WeekStep As Integer
Dim TotalSheets As Integer
Dim x As Integer
WeekStep = InputBox("Number of weeks per worksheet:")
TotalSheets = InputBox("Number of Worksheets:")
For x = 2 To TotalSheets
Sheets(x).Select
Range("A5").Select
ActiveCell.FormulaR1C1 = "=Sheets(x-1)!RC+2"
Next x