shorten value in a cell
I experimented with the sheetname as rvenkataraman
and then used this code
Public Sub test()
Dim x As String
x = ActiveSheet.Name
MsgBox x
If Len(x) 10 Then x = Left(x, 5)
ActiveSheet.Name = x
MsgBox ActiveSheet.Name
End Sub
you can introduce a loop to check all the worksheets in the workbook and use
this sub in each loop
JH wrote in message
...
Hello,
I just found an unexpected problem.
I have a sheet with a list of suppliers
I create new sheets in my macro that are called after suppliers. One sheet
one supplier.
And the problem occurs when I'm creating new sheets.
Some supplier's names are longer than 31 char. and sheet's name cannot be
longer than 31 characters.If so run-time errror occurs
I'd need to validate supplier's name before creating the new sheet.
If that name is longer than 31 char I would like to shorten supplier's
name
so that is shorter than 31 char and I don't know how.
can anybody help me please
Thanks
JH
|