![]() |
Trim Variable
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 *** |
Trim Variable
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 *** |
Trim Variable
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 *** |
Trim Variable
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 *** |
Trim Variable
Thanks very much, Tom your result is what i was looking for.
Les Stout *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 12:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com