Excelerate2
New Member
- Joined
- Mar 18, 2022
- Messages
- 25
- Office Version
- 365
- 2019
- 2016
- 2010
- Platform
- Windows
Hi folks! How do I replace the tab's name ('Electrical') with the actual Sheet name (Sheet 11)?
Whenever I try it doesn't work, here is the good working code below, just need to use the sheet name (Sheet11) instead of the tab name ('Electrical'):
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "D107" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "=Electrical!I181"
Application.EnableEvents = True
End If
End If
All this does is simply inputs a cell reference from another tab in same workbook: 'Electrical' tab (cell I181) unless the target cell (D107) already has a value (is not blank).
And it should input it again if I clear (delete) the value in the target cell (D107).
Then I repeat this code for several more entries (below it) and then End Sub.
(All works perfectly above using the 'tab's name' but need to change it to 'Sheet name' in case user changes the tab name)
Any help would be great - Thanks much!
Whenever I try it doesn't work, here is the good working code below, just need to use the sheet name (Sheet11) instead of the tab name ('Electrical'):
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "D107" Then
If IsEmpty(.Value) Then
Application.EnableEvents = False
.Formula = "=Electrical!I181"
Application.EnableEvents = True
End If
End If
All this does is simply inputs a cell reference from another tab in same workbook: 'Electrical' tab (cell I181) unless the target cell (D107) already has a value (is not blank).
And it should input it again if I clear (delete) the value in the target cell (D107).
Then I repeat this code for several more entries (below it) and then End Sub.
(All works perfectly above using the 'tab's name' but need to change it to 'Sheet name' in case user changes the tab name)
Any help would be great - Thanks much!