RonNCmale
10-01-2015, 01:26 AM
I have this code that will change the name of the worksheet as long as a worksheet is present.
Private Sub Worksheet_Change(ByVal Target As Range)
Set SensitiveRange = Range("A1:A8")
Set myRange = Intersect(Target, SensitiveRange)
If Not myRange Is Nothing Then
For Each cll In myRange.Cells
If IsEmpty(cll) Then
Sheets(cll.Row + 2).Name = Sheets(cll.Row + 2).CodeName
Else
Sheets(cll.Row + 2).Name = cll.Value
End If
Next cll
End If
End Sub
Can I expand this code to add a worksheet if text is entered on an empty cell between lines A1 thru A8.
Attached is the workbook
thanks in advance
Private Sub Worksheet_Change(ByVal Target As Range)
Set SensitiveRange = Range("A1:A8")
Set myRange = Intersect(Target, SensitiveRange)
If Not myRange Is Nothing Then
For Each cll In myRange.Cells
If IsEmpty(cll) Then
Sheets(cll.Row + 2).Name = Sheets(cll.Row + 2).CodeName
Else
Sheets(cll.Row + 2).Name = cll.Value
End If
Next cll
End If
End Sub
Can I expand this code to add a worksheet if text is entered on an empty cell between lines A1 thru A8.
Attached is the workbook
thanks in advance