Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default error 438 on For statement

It has an object doesn't support this property and I don't see anything wrong.

Sub AddNodeCommas()
Dim SlashPos As Long
Dim myCell As Range

For Each myCell In ActiveSheet.Ranges("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

tia,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default error 438 on For statement

Range S

However, this might be a little more efficient.
Sub ifslash()
lr = Cells(Rows.Count, "d").End(xlUp).Row
For Each c In Range("d2:d" & lr)
If InStr(c, "/") < 1 And c < "" Then c.Value = c & ","
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Janis" wrote in message
...
It has an object doesn't support this property and I don't see anything
wrong.

Sub AddNodeCommas()
Dim SlashPos As Long
Dim myCell As Range

For Each myCell In ActiveSheet.Ranges("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

tia,


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
Can't fix On Error statement austris Excel Discussion (Misc queries) 7 October 13th 06 07:09 AM
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Path/File access error (Error 75) using Name Statement blayne Excel Programming 7 November 22nd 05 09:20 PM
Path/File access error (Error 75) after using Name Statement blayne Excel Programming 0 November 10th 05 12:33 AM
On Error Statement Heapy Excel Programming 1 September 22nd 03 05:22 PM


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