MBellew1463
New Member
- Joined
- Jun 8, 2022
- Messages
- 10
- Office Version
- 2021
- Platform
- Windows
So I have the below code written to evaluate if a specific sheet name exists and if so transfer some data - works great BUT now they have changed the way the report comes out and I need to be able to do the same thing with a "dynamic" sheet name so thought it would be best to use the tab index but I have not been able to figure out how to go about this... The code below is just an excerpt as it rolls through 100 different sheets but if I can get it to do one then I can fix the rest: "Sheet1" is actually tab 4
With Sheets("JSR SUMMARY")
If Evaluate("isref('sheet1'!A1)") Then
Sheets("Sheet1").Range("G4").Value = .Range("T4").Value
End If
If Evaluate("isref('sheet1'!A1)") Then
Sheets("Sheet1").Range("G5").Value = .Range("T4").Value
End If
If Evaluate("isref('sheet2'!A1)") Then
Sheets("Sheet2").Range("G4").Value = .Range("T5").Value
End If
If Evaluate("isref('sheet3'!A1)") Then
Sheets("Sheet3").Range("G4").Value = .Range("T6").Value
End If
If Evaluate("isref('sheet4'!A1)") Then
Sheets("Sheet4").Range("G4").Value = .Range("T7").Value
End If
If Evaluate("isref('sheet5'!A1)") Then
Sheets("Sheet5").Range("G4").Value = .Range("T8").Value
End If
With Sheets("JSR SUMMARY")
If Evaluate("isref('sheet1'!A1)") Then
Sheets("Sheet1").Range("G4").Value = .Range("T4").Value
End If
If Evaluate("isref('sheet1'!A1)") Then
Sheets("Sheet1").Range("G5").Value = .Range("T4").Value
End If
If Evaluate("isref('sheet2'!A1)") Then
Sheets("Sheet2").Range("G4").Value = .Range("T5").Value
End If
If Evaluate("isref('sheet3'!A1)") Then
Sheets("Sheet3").Range("G4").Value = .Range("T6").Value
End If
If Evaluate("isref('sheet4'!A1)") Then
Sheets("Sheet4").Range("G4").Value = .Range("T7").Value
End If
If Evaluate("isref('sheet5'!A1)") Then
Sheets("Sheet5").Range("G4").Value = .Range("T8").Value
End If