jdluke6545
New Member
- Joined
- Jul 30, 2021
- Messages
- 47
- Office Version
- 2019
- Platform
- Windows
I recently posted about a pretty difficult VBA code and you folks here were absolutely great in resolving my problem.
Now, I have another one, in the same workbook but on different sheets, so I know I'm in the right place.
I have a VBA code that that makes a sheet tab name reference a cell value.
That code is this:
Now I made a couple minor changes to that same code to fit for a different sheet
which is this:
"Run-time error: 1004:
The specified dimension is not valid for the current chart type"
And yes, I do have a couple of charts on this "Summary" sheet where as on the other sheets where I used the first code there are no charts on those, so no error.
So, what is it about having a chart on this "Summary" sheet that I can not use the code to do what I need?
And also, if I were to put a chart (or charts) on the other sheets would I get the same error? (I'm guessing I would)
But more importantly, what do I need to change in my code to make this work in a sheet with charts?
Thanks for the help !!!
Now, I have another one, in the same workbook but on different sheets, so I know I'm in the right place.
I have a VBA code that that makes a sheet tab name reference a cell value.
That code is this:
and this is working flawlessly.Private Sub Worksheet_Change(ByVal Target As Range)
Dim CELL1 As String
Dim CELL2 As String
Dim CELL3 As String
Dim TABNAME As String
CELL1 = Range("O1")
CELL2 = Range("O2")
CELL3 = Range("O3")
TABNAME = CELL1 & " " & CELL2
If Not Intersect(Target, Range("O1")) Is Nothing Then
'ActiveSheet.Name = ActiveSheet.Range("O1")
ActiveSheet.Name = TABNAME & " First"
End If
End Sub
Now I made a couple minor changes to that same code to fit for a different sheet
which is this:
But this one is giving me the error:Private Sub Worksheet_Change(ByVal Target As Range)
Dim CELL1 As String
Dim CELL2 As String
Dim CELL3 As String
Dim TABNAME As String
CELL1 = Range("O1")
CELL2 = Range("O2")
CELL3 = Range("O3")
TABNAME = CELL1 & " " & CELL3
If Not Intersect(Target, Range("O1")) Is Nothing Then
'ActiveSheet.Name = ActiveSheet.Range("O1")
ActiveSheet.Name = "Summary - " & TABNAME
End If
End Sub
"Run-time error: 1004:
The specified dimension is not valid for the current chart type"
And yes, I do have a couple of charts on this "Summary" sheet where as on the other sheets where I used the first code there are no charts on those, so no error.
So, what is it about having a chart on this "Summary" sheet that I can not use the code to do what I need?
And also, if I were to put a chart (or charts) on the other sheets would I get the same error? (I'm guessing I would)
But more importantly, what do I need to change in my code to make this work in a sheet with charts?
Thanks for the help !!!