Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Delete characters up to ":"

You can use InStr() to search for the colon and Mid() to ignore the stuff before
it.

Option Explicit
Sub testme()

Dim myStr As String
Dim colonPos As Long

myStr = "this is a test: for removing colons"

colonPos = InStr(1, myStr, ":")
If colonPos 0 Then
myStr = Mid(myStr, colonPos + 1) '+2 to get rid of the linefeed?
End If

MsgBox myStr

End Sub

Robbyn wrote:

I have created a report page that copies comment.txt from the source page (thanks again for help Tom). I'm wondering if it's possible to delete all characters up to and including the ":" on the report page. (This will get rid of the username info).

Robbyn

(Make it stop raining please, ty)


--

Dave Peterson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Delete characters up to ":"

Ok Dave, playing around with it to see what I get. Thanks for the help. :)

Robbyn
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Delete characters up to ":"

Okay Dave. Can't sleep so played around with your code, and it most definitely works when I use activeCell. But the following code doesn't

Sub textme(

Dim myStr As Strin
Dim colonPos As Lon
Dim cell As Rang

For Each cell In Range("a1:a15"
myStr = cell.Valu
colonPos = InStr(1, myStr, ":"
If colonPos 0 The
myStr = Mid(myStr, colonPos + 1
End I
Next cel

End Su

Any idea why? (thanks again

Robbyn
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Delete characters up to ":"

Please disregard post. Figured out my problem. :

Robbyn
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
is there a way to delete all characters to the right of a ":"? [email protected] Excel Discussion (Misc queries) 4 May 11th 23 11:47 AM
If specific # of certain characters in a range, "OK", if not "Aler Steve Excel Worksheet Functions 4 June 10th 09 07:05 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM


All times are GMT +1. The time now is 02:56 PM.

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

About Us

"It's about Microsoft Excel"