Here is my code,
If ActiveWorkbook.Sheets("About tool").Range("G1").Value = 1 Then
ActiveWorkbook.Sheets("About tool").Range("G1").Value = 0
With ActiveWorkbook.Sheets("About tool").Shapes("Rounded Rectangle 2").TextFrame2
If .HasText Then
.TextRange.Delete
.TextRange.Text = "Unlock All"
End If
End With
ElseIf ActiveWorkbook.Sheets("About tool").Range("G1").Value = 0 Then
ActiveWorkbook.Sheets("About this tool ").Range("G1").Value = 1
With ActiveWorkbook.Sheets("About tool").Shapes("Rounded Rectangle 2").TextFrame2
If .HasText Then
.TextRange.Delete
.TextRange.Text = "Lock All"
End If
End With
End If
Here on the ELSEIF section, I am getting an error saying "runtime error -2147024809 (80070057) the specified value is out of range".
It is working fine in the IF section. it is the same code with just change in the string passed as text.