rcrumbliss
New Member
- Joined
- Jan 30, 2024
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
this is probably a really lame question, but I can't seem to figure out how to make this work.
I have a range that I have autofiltered. I then need to look at the rows in that range, to see if a certain variable value falls between the values of columns 6 and 7.
For clarification, I have a data set over 25000 entries in size that contain address ranges. Many of these are single addresses (1234-1234 my lane) but most are ranges (1235-1299 my lane)
I can filter down to the street, but am then left with multiple entries. I just need to get the row for the address I am looking for, and then pull information from 2 columns into a different worksheet.
I dont want to use a for...next loop because I need to reduce the clock cycles this is going to take to process.
This is what I thought would work, but it doesnt.
Can anyone please clue me in on what I need to use instead of rng.Column(#) to access the data?
Thank you in advance
I have a range that I have autofiltered. I then need to look at the rows in that range, to see if a certain variable value falls between the values of columns 6 and 7.
For clarification, I have a data set over 25000 entries in size that contain address ranges. Many of these are single addresses (1234-1234 my lane) but most are ranges (1235-1299 my lane)
I can filter down to the street, but am then left with multiple entries. I just need to get the row for the address I am looking for, and then pull information from 2 columns into a different worksheet.
I dont want to use a for...next loop because I need to reduce the clock cycles this is going to take to process.
This is what I thought would work, but it doesnt.
VBA Code:
Dim rRange As Range, filRange As Range, rng As Range
Set rRange = Sheets("ENTIRE_CENTER").Range("A2:Z30000")
With rRange
.AutoFilter
.AutoFilter Field:=10, Criteria1:=Street
.AutoFilter Field:=9, Criteria1:=Pfx
If StrType <> "" And Not IsEmpty(StrType) Then .AutoFilter Field:=11, Criteria1:=StrType
.AutoFilter Field:=12, Criteria1:=Sfx
.AutoFilter Field:=15, Criteria1:=Postal
Set filRange = .Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow
For Each rng In filRange
'if StrtNum > min AND StrtNum < Max then = source
If StrtNum > rng.Column(6).Value And _
StrtNum < rng.Column(7).Value Then
If rng.Column(3).Value < 10 Then ctrLoop = "0" & rng.Column(3).Value Else ctrLoop = rng.Column(3).Value
OutputTab.Range("N" & y) = "9801" & ctrLoop & rng.Column(4).Value
Else
'do nothing
End If
Next rng
End With
Can anyone please clue me in on what I need to use instead of rng.Column(#) to access the data?
Thank you in advance