Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default searching for slashes "/" in cells

I need someone to fill in the blanks:

Sub AddNodeCommas()

For each C in Intersect Range("D2:D122")
if c =*"/"
substitute(c,c,c&",")
Else

Next
End Sub

What I want to do is add a comma to the end of the text in the cells if the
cell does not contain a / (forward slash). I got a syntax error in here.
this time I didn't forget the "'s

tia,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default searching for slashes "/" in cells

Maybe...


Option Explicit
Sub AddNodeCommas2()

Dim SlashPos As Long
Dim myCell As Range

For Each myCell In ActiveSheet.Range("d2:d122").Cells
If myCell.Value = "" Then
'skip it???
Else
SlashPos = InStr(1, myCell.Value, "/", vbTextCompare)
If SlashPos 0 Then
'/ was found, so skip it
Else
myCell.Value = myCell.Value & ","
End If
End If
Next myCell

End Sub




Janis wrote:

I need someone to fill in the blanks:

Sub AddNodeCommas()

For each C in Intersect Range("D2:D122")
if c =*"/"
substitute(c,c,c&",")
Else

Next
End Sub

What I want to do is add a comma to the end of the text in the cells if the
cell does not contain a / (forward slash). I got a syntax error in here.
this time I didn't forget the "'s

tia,


--

Dave Peterson
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
Searching for a "LESS THAN"" amount within a sheet! FLKULCHAR Excel Discussion (Misc queries) 1 February 22nd 10 03:32 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
searching for cells that "contain" certain value Giulia Excel Discussion (Misc queries) 3 July 18th 06 05:44 PM
Can you "duplicate" "copy" listboxes and code to multiple cells? HotRod Excel Programming 1 September 1st 04 05:03 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 11:03 PM.

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"