Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Number generating an error
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Number generating an error
Replace your + with a & sign
"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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto generating number | Excel Discussion (Misc queries) | |||
how do i set up automatic number generating | Excel Worksheet Functions | |||
Generating an auto number | Excel Worksheet Functions | |||
Generating Error for UDF | Excel Programming | |||
Generating (in a random order)each number once from a given number | Excel Worksheet Functions |