I have written a macro that loops through a column of data finding matching entries. Where a = the starting value I want to match and c becomes the end of the matching entries.
MySup = Range("B" & a)
For y = a To b
If Range("B" & y) <> MySup Then
c = y - 1
y = b
End If
Next y
This works well as long as the data I want to use is in column B but I am trying to set this up so that others can use the spreadsheet and not have to worry about column arrangment.
I can find the specific column with this code
Cells.Find(What:="Supervisor", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
col1 = ActiveCell.Column
Is there a way to use the variable col1 (or any variable for that matter) to specify the column I am looking for.
I want to locate the specific column and starting with "a" and sequentially run through it "1-5000" looking for matches to MySup.
I thank everyone in advance for assistance.
MySup = Range("B" & a)
For y = a To b
If Range("B" & y) <> MySup Then
c = y - 1
y = b
End If
Next y
This works well as long as the data I want to use is in column B but I am trying to set this up so that others can use the spreadsheet and not have to worry about column arrangment.
I can find the specific column with this code
Cells.Find(What:="Supervisor", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
col1 = ActiveCell.Column
Is there a way to use the variable col1 (or any variable for that matter) to specify the column I am looking for.
I want to locate the specific column and starting with "a" and sequentially run through it "1-5000" looking for matches to MySup.
I thank everyone in advance for assistance.