K
Kermitp
I am trying to find users (email address) in a range within a single column.
The column changes as I process worksheets. I have a list of contacts in
another worksheet:
In the code below I explain which statement works and which one fails. I
need a method to move from column to column searching for matching email
addresses.
I appreciate any help you can give to solve this problem. I'm open to all
suggestions.
Thanks, Kermitp
_____________________________________________
____________________________________________
Sub findeachopen()
gonogo = "Y"
contactCol = 2
' "NL-opens-by-NL" ' contains a Column (A) with master list of email
addresses and a column for each sent email
' "NL-opens" ' contains multple columns with list of who opened the email
' this sub finds if the person has open each email and marks the cell Y
or N in that email column
' this way we can determine how many emails each person has opened
While Not (IsEmpty(Worksheets("NL-opens-by-NL").Cells(1, contactCol).Value)
Or gonogo = "N")
contactstartrow = 2
contactRow = 2
contactlastrow = 300
headrow = 1
With Worksheets(1)
.Range(.Cells(1, 1), _
.Cells(10, 10)).Borders.LineStyle = xlThick
End With
While Not (IsEmpty(Worksheets("NL-opens-by-NL").Cells(contactRow,
"A").Value) Or gonogo = "N")
UserName = Worksheets("NL-opens-by-NL").Cells(contactRow, "A").Value
'
' The next statement get an error of Invalid or unqualified reference
'
With Worksheets("NL-opens").Range(.Cells(contactstartrow,
contactCol), .Cells(contactlastrow, contactCol))
'
' The next statement works but I can't change the Column in the range
' which I need to do in order to procees all columns
'
' With Worksheets("NL-opens").Range("B2:B300")
Set c = .Find(UserName, LookIn:=xlValues)
If Not c Is Nothing Then
Worksheets("NL-opens-by-NL").Cells(contactRow,
contactCol).Value = "Y"
Else
Worksheets("NL-opens-by-NL").Cells(contactRow,
contactCol).Value = "N"
End If
End With
contactRow = contactRow + 1
Wend
contactCol = contactCol + 1
Wend
End Sub
The column changes as I process worksheets. I have a list of contacts in
another worksheet:
In the code below I explain which statement works and which one fails. I
need a method to move from column to column searching for matching email
addresses.
I appreciate any help you can give to solve this problem. I'm open to all
suggestions.
Thanks, Kermitp
_____________________________________________
____________________________________________
Sub findeachopen()
gonogo = "Y"
contactCol = 2
' "NL-opens-by-NL" ' contains a Column (A) with master list of email
addresses and a column for each sent email
' "NL-opens" ' contains multple columns with list of who opened the email
' this sub finds if the person has open each email and marks the cell Y
or N in that email column
' this way we can determine how many emails each person has opened
While Not (IsEmpty(Worksheets("NL-opens-by-NL").Cells(1, contactCol).Value)
Or gonogo = "N")
contactstartrow = 2
contactRow = 2
contactlastrow = 300
headrow = 1
With Worksheets(1)
.Range(.Cells(1, 1), _
.Cells(10, 10)).Borders.LineStyle = xlThick
End With
While Not (IsEmpty(Worksheets("NL-opens-by-NL").Cells(contactRow,
"A").Value) Or gonogo = "N")
UserName = Worksheets("NL-opens-by-NL").Cells(contactRow, "A").Value
'
' The next statement get an error of Invalid or unqualified reference
'
With Worksheets("NL-opens").Range(.Cells(contactstartrow,
contactCol), .Cells(contactlastrow, contactCol))
'
' The next statement works but I can't change the Column in the range
' which I need to do in order to procees all columns
'
' With Worksheets("NL-opens").Range("B2:B300")
Set c = .Find(UserName, LookIn:=xlValues)
If Not c Is Nothing Then
Worksheets("NL-opens-by-NL").Cells(contactRow,
contactCol).Value = "Y"
Else
Worksheets("NL-opens-by-NL").Cells(contactRow,
contactCol).Value = "N"
End If
End With
contactRow = contactRow + 1
Wend
contactCol = contactCol + 1
Wend
End Sub