Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default identifying the first character in a string

I have several colums of data with names. The names are inputed in the
following way:
'daniel
'michael
'ted

how do i loop through the column and erase only the " ' " that is beginning
of each name?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default identifying the first character in a string

Hi dstiefe,

You could try this. Note that it requires at least one cell in the target
column is selected.

Sub RemoveFirstChar()
' Removes the first character in a string value
' Requires that any cell(s) in the target column be selected

Dim c As Range
Dim lLastRow As Long, r As Long, iCol As Integer

iCol = Selection.Column
lLastRow = Cells(Rows.Count, iCol).End(xlUp).Row

For r = 1 To lLastRow
If Not IsEmpty(Cells(r, iCol)) Then
If Left$(Cells(r, iCol).Value, 1) = Chr$(39) Then _
Cells(r, iCol).Value = Mid$(Cells(r, iCol).Value, 2)
End If
Next
End Sub


Regards,
GS
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
problem with test to columns feature identifying odd delimiting character mark_jm via OfficeKB.com Excel Discussion (Misc queries) 4 May 4th 10 11:22 AM
Identifying the presence of a randomly ordered text string in a cell AG[_3_] Excel Worksheet Functions 2 September 3rd 09 10:21 PM
Excel-Match 1st text character in a string to a known character? bushlite Excel Worksheet Functions 2 January 15th 07 06:36 PM
identifying a string of positive numbers mcarrington Excel Worksheet Functions 1 January 13th 06 12:34 AM
Function to return Character Position of Xth character within a string Andibevan[_2_] Excel Programming 4 June 9th 05 03:24 PM


All times are GMT +1. The time now is 04:32 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"