Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to add spaces in a tempory name. What I have been trying without any
luck is; tmpName2 = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 11) tmpName2 = Left(tmpName2, Len(tmpName2) - 13 & " " & -11 & " " - 8 & " " & -2 & " "). What I need for it to do is to subtract the last 11 characters in the active workbook name and then add spaces in the 13th,11th, 8th and 2nd spaces so that; 12345678901213141516171819292122; would become 123456789012131415161; then 12345678 90 121 314151 61; It does not work. Any help is truly apprectiate. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ronbo,
This might give you an idea of accomplishing what you want. Dave Sub Parse() Dim tmpName2 As String tmpName2 = "12345678901213141516171819292122" tmpName2 = Left(tmpName2, Len(tmpName2) - 11) tmpName2 = Left(tmpName2, 8) & " " & Mid(tmpName2, 9, 2) & " " & Mid(tmpName2, 11, 3) & " " & Mid(tmpName2, 14, 6) & " " & Right(tmpName2, 2) MsgBox (tmpName2) End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help, but I am not getting anywhere. Using your code I get
12345sss45 or characters 1 to 5 and then three blanks spaces then repeat characters 45. I have tried revising but anm not getting anywhere. Any other ideas? "Dave Unger" wrote: Ronbo, This might give you an idea of accomplishing what you want. Dave Sub Parse() Dim tmpName2 As String tmpName2 = "12345678901213141516171819292122" tmpName2 = Left(tmpName2, Len(tmpName2) - 11) tmpName2 = Left(tmpName2, 8) & " " & Mid(tmpName2, 9, 2) & " " & Mid(tmpName2, 11, 3) & " " & Mid(tmpName2, 14, 6) & " " & Right(tmpName2, 2) MsgBox (tmpName2) End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ronbo,
Maybe I'm not understanding the question correctly. Using your example, I started with a workbook name of 32 characters - your 1st statement cuts off the right 11 characters, leaving a string of 21 characters to process. Is this right, or am I missing something? Dave |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are actually 27 characters and it would go as follows;
111223333334445566666666666 Changed to; 111 22 333333 444 55 The first statements removes the last 11 characters and leaves 1112233333344455 What I need is the syntax to insert the spaces in the name. "Dave Unger" wrote: Ronbo, Maybe I'm not understanding the question correctly. Using your example, I started with a workbook name of 32 characters - your 1st statement cuts off the right 11 characters, leaving a string of 21 characters to process. Is this right, or am I missing something? Dave |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following works for me:
X = Left$(X, 16) X = Format$(X,"000 00 000000 000 00") and (surprisingly, given the 15-digit precision), it comes out correctly when X = 9,999,999,999,999,999 On Mon, 14 Mar 2005 09:15:02 -0800, "Ronbo" wrote: There are actually 27 characters and it would go as follows; 111223333334445566666666666 Changed to; 111 22 333333 444 55 The first statements removes the last 11 characters and leaves 1112233333344455 What I need is the syntax to insert the spaces in the name. "Dave Unger" wrote: Ronbo, Maybe I'm not understanding the question correctly. Using your example, I started with a workbook name of 32 characters - your 1st statement cuts off the right 11 characters, leaving a string of 21 characters to process. Is this right, or am I missing something? Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I remove leading spaces and leave the remianing spaces w | Excel Worksheet Functions | |||
spaces not recognized as spaces | Excel Worksheet Functions | |||
A better way to get rid of spaces | Excel Programming | |||
Help copying a range with spaces to a range without spaces | Excel Programming | |||
Spaces | Excel Programming |