Number generating an error
"+" is the addition operator. When used with two text arguments, it
performs the same function as the concatenation operator (&), but when
one argument is text and one is numeric, it causes a type mismatch error.
Use the concatenation operator instead:
Sheets(2).Name = Sheets(1).Cells(4, 6).Value & " Equip Info"
In article ,
Mr. Matt wrote:
I have the code below to rename Worksheet 2. When the value in 4, 6 is a
number, e.g. 5, I get an error. Text works fine. Any suggestions?
Thanks
Private Sub CommandButton1_Click()
Sheets(2).Name = Sheets(1).Cells(4, 6).Value + " Equip Info"
End Sub
|