Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default How to Strip Leading Spaces and Underscores from Object

I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces.

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)


Range ( "A14") = SMPL 'text is put on the spreadsheet


Here's an example of what would show up on the spreadsheet .....

___ TEXT


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default How to Strip Leading Spaces and Underscores from Object

On 24 Dic, 21:59, TomP wrote:
I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces. *

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)

Range ( "A14") = SMPL 'text is put on the spreadsheet

Here's an example of what would show up on the spreadsheet .....

___ TEXT



Hi Tom.
See:
http://www.tmehta.com/regexp/
Buon Natale
Eliano
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default How to Strip Leading Spaces and Underscores from Object

On Wed, 24 Dec 2008 12:59:00 -0800, TomP
wrote:

I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces.

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)


Range ( "A14") = SMPL 'text is put on the spreadsheet


Here's an example of what would show up on the spreadsheet .....

___ TEXT



Try this used defined function:

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)

Hope this helps
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default How to Strip Leading Spaces and Underscores from Object

I'm sorry, but, I'm not real sure how to apply this function. Where would I
put my object string SMPL that needs to be trimmed? My next question is how
does cell B14 get in to the picture? Couldn't I just assign the object from
the code?

Thank you,

Tom

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)


"Lars-Ã…ke Aspelin" wrote:

On Wed, 24 Dec 2008 12:59:00 -0800, TomP
wrote:

I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces.

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)


Range ( "A14") = SMPL 'text is put on the spreadsheet


Here's an example of what would show up on the spreadsheet .....

___ TEXT



Try this used defined function:

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)

Hope this helps

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default How to Strip Leading Spaces and Underscores from Object

Put this in your code before you store the string in cell A14:

SMPL = r_l_s_u(SMPL)

Hope this helps / Lars-Åke


On Mon, 29 Dec 2008 09:09:01 -0800, TomP
wrote:

I'm sorry, but, I'm not real sure how to apply this function. Where would I
put my object string SMPL that needs to be trimmed? My next question is how
does cell B14 get in to the picture? Couldn't I just assign the object from
the code?

Thank you,

Tom

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)


"Lars-Åke Aspelin" wrote:

On Wed, 24 Dec 2008 12:59:00 -0800, TomP
wrote:

I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces.

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)


Range ( "A14") = SMPL 'text is put on the spreadsheet


Here's an example of what would show up on the spreadsheet .....

___ TEXT



Try this used defined function:

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)

Hope this helps




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default How to Strip Leading Spaces and Underscores from Object

It works now, but what would I have to do to remove 3 more spaces before it
finds the first character? Most of the spaces and underscores were removed.

Thank you

"Lars-Ã…ke Aspelin" wrote:

Put this in your code before you store the string in cell A14:

SMPL = r_l_s_u(SMPL)

Hope this helps / Lars-Ã…ke


On Mon, 29 Dec 2008 09:09:01 -0800, TomP
wrote:

I'm sorry, but, I'm not real sure how to apply this function. Where would I
put my object string SMPL that needs to be trimmed? My next question is how
does cell B14 get in to the picture? Couldn't I just assign the object from
the code?

Thank you,

Tom

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)


"Lars-Ã…ke Aspelin" wrote:

On Wed, 24 Dec 2008 12:59:00 -0800, TomP
wrote:

I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces.

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)


Range ( "A14") = SMPL 'text is put on the spreadsheet


Here's an example of what would show up on the spreadsheet .....

___ TEXT



Try this used defined function:

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)

Hope this helps



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default How to Strip Leading Spaces and Underscores from Object

Disregard my previous reply. I got it to work!

Happy New Year!

Tom

"TomP" wrote:

It works now, but what would I have to do to remove 3 more spaces before it
finds the first character? Most of the spaces and underscores were removed.

Thank you

"Lars-Ã…ke Aspelin" wrote:

Put this in your code before you store the string in cell A14:

SMPL = r_l_s_u(SMPL)

Hope this helps / Lars-Ã…ke


On Mon, 29 Dec 2008 09:09:01 -0800, TomP
wrote:

I'm sorry, but, I'm not real sure how to apply this function. Where would I
put my object string SMPL that needs to be trimmed? My next question is how
does cell B14 get in to the picture? Couldn't I just assign the object from
the code?

Thank you,

Tom

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)


"Lars-Ã…ke Aspelin" wrote:

On Wed, 24 Dec 2008 12:59:00 -0800, TomP
wrote:

I have a string that captures text from a mainframe and would like to know
how to get rid of the underscores and spaces.

Here's an example of what I have

Dim SMPL as String

SMPL = CurrentScreenObject.GetString (3, 30, 25)


Range ( "A14") = SMPL 'text is put on the spreadsheet


Here's an example of what would show up on the spreadsheet .....

___ TEXT



Try this used defined function:

Function r_l_s_u(s As String) As String
' removes leading spaces and underscores
Dim x As String
x = s
Do While (Mid(x, 1, 1) = "_" Or Mid(x, 1, 1) = " ")
x = Mid(x, 2)
Loop
r_l_s_u = x
End Function

In cell B14 you put the formula =r_l_s_u(A14)

Hope this helps



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strip leading zeros Compass Rose Excel Worksheet Functions 5 June 25th 08 07:16 PM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
How can I replace spaces in text cells (excel) with underscores? JB2006 New Users to Excel 2 April 20th 06 06:05 PM
Strip leading spaces from cell Pete Excel Worksheet Functions 3 July 31st 05 02:26 AM
using spaces instead of underscores Jason Excel Programming 3 April 10th 04 11:25 PM


All times are GMT +1. The time now is 05:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"