Emoncada
09-15-2015, 11:45 AM
I have the following code
Dim Track As String
For x = 2 To Lr
Track = ws.Cells(x, "B")
If ws.Cells(x, "A") <> "" Then
ws.Cells(x, "D") = Application.WorksheetFunction.VLookup(ws.Cells(x, "A"), wsEmail.Range("A2:E" & LrEmail), 4, False)
ws.Cells(x, "E") = Application.WorksheetFunction.VLookup(ws.Cells(x, "A"), wsEmail.Range("A2:E" & LrEmail), 5, False)
ws.Cells(x, "F") = "=ShipTrack(" & Track & ",""UPS"")"
shipD = ws.Cells(x, "C")
Days = DateDiff("d", shipD, nowD)
ws.Cells(x, "G") = Days
End If
Next x
I keep getting a runtime error and I was able to figure out that the problem is ws.cells(x, "B") always starts with a "1", but if I enter a letter infront of it this code works fine.
How can I have it get that cell value even when it starts with a number?
Dim Track As String
For x = 2 To Lr
Track = ws.Cells(x, "B")
If ws.Cells(x, "A") <> "" Then
ws.Cells(x, "D") = Application.WorksheetFunction.VLookup(ws.Cells(x, "A"), wsEmail.Range("A2:E" & LrEmail), 4, False)
ws.Cells(x, "E") = Application.WorksheetFunction.VLookup(ws.Cells(x, "A"), wsEmail.Range("A2:E" & LrEmail), 5, False)
ws.Cells(x, "F") = "=ShipTrack(" & Track & ",""UPS"")"
shipD = ws.Cells(x, "C")
Days = DateDiff("d", shipD, nowD)
ws.Cells(x, "G") = Days
End If
Next x
I keep getting a runtime error and I was able to figure out that the problem is ws.cells(x, "B") always starts with a "1", but if I enter a letter infront of it this code works fine.
How can I have it get that cell value even when it starts with a number?