Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, i have a string variable and i need to replace the first 12
places (Left side), which are 8 numeric (Variable) and 4 spaces, (constant). Is it possible to do this and if so could you please help with some code. thanks in advance. Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is how I understand what you are asking, hope I have it right: You want
code that will "overwrite" the first 12 characters of your string, so these characters will be erased and replaced with an 8 digit number that you have in a different string variable and then 4 spaces. If that is it, then this should do: MyString = DigitString & " " & Right(MyString, Len(MyString)-12) -- - K Dales "Les Stout" wrote: Hi all, i have a string variable and i need to replace the first 12 places (Left side), which are 8 numeric (Variable) and 4 spaces, (constant). Is it possible to do this and if so could you please help with some code. thanks in advance. Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() sStr = "12345678 The Big Dog" sStr = Right(sStr,len(sStr)-12) demo'd from the immediate window: sStr = "12345678 The Big Dog" sStr = Right(sStr,len(sStr)-12) ? sStr The Big Dog -- Regards, Tom Ogilvy "Les Stout" wrote in message ... Hi all, i have a string variable and i need to replace the first 12 places (Left side), which are 8 numeric (Variable) and 4 spaces, (constant). Is it possible to do this and if so could you please help with some code. thanks in advance. Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks very much, Tom your result is what i was looking for.
Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Replace()
Dim sVar As String Dim WhatEver As String sVar = Right(sVar, Len(sVar) - 12) WhatEver = "whatevruwant" sVar = WhatEver & sVar End Sub Mike F "Les Stout" wrote in message ... Hi all, i have a string variable and i need to replace the first 12 places (Left side), which are 8 numeric (Variable) and 4 spaces, (constant). Is it possible to do this and if so could you please help with some code. thanks in advance. Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
trim | Excel Discussion (Misc queries) | |||
VBA and Trim | Excel Programming | |||
VBA Trim and Application.worksheetfunction.Trim | Excel Programming | |||
Trim in VBA | Excel Programming | |||
Trim like worksheet Trim | Excel Programming |