Not really sure what you're trying to do but try this as an example:
Sub Macro1()
Dim VisibleRange As Range
Dim c As Range
With Range("A1")
.AutoFilter
.AutoFilter Field:=5, Criteria1:="CO"
Set VisibleRange = _
Intersect(.SpecialCells(xlCellTypeVisible), _
Columns("E"), _
ActiveSheet.UsedRange)
End With
MsgBox VisibleRange.Address
For Each c In VisibleRange
MsgBox c.Address
Next 'c
End Sub
It uses AutoFilter to reduce the number of rows to be processed to just
those with "CO" in column E.
Regards
Trevor
"adidas VBA" wrote in message
...
How can I convert this code to say
if value in column E = "CO" then this code
Right now it detects CRJ, ER3 and others in Column J and adds lette E to
everything in Column 3. I would like some additional control on the
code. Help appreciated.
Dim mycounter As Double
Dim c As Range
Dim d As Range
mycounter = 1
Do While mycounter < 35001
Set c = Range("J" & mycounter)
Select Case c.Text
Case Is = "CRJ", "EM2", "ER3", "ER4", "ERD", "ERJ"
Set d = Range("E" & mycounter)
d.Value = d.Value & IIf(Right(d.Text, 1) < "E", "E", "")
End Select
mycounter = mycounter + 1
Loop
Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!