![]() |
Anybody see anything wrong with this
I am trying to do a lookup, it doesn't error out and it goes through the
conditions, but it doesn't update the value. Any ideas? Dim Res as Variant z = 5 Do While Range("DCI!A" & z).Value = Date If CStr(Range("DCI!J" & z).Value) = "000" Then Res = Application.Lookup(Left(Range("DCI!D" & z), 3), Range("HTC!$A$2:$A$200"), Range("HTC!$B$2:$B$200")) If Not IsError(Res) Then Range("DCI!J" & z).Value = Res Else Range("DCI!J" & z).Value = "Not Found-" & Res End If End If z = z + 1 Loop |
Anybody see anything wrong with this
I have made a some progress on this, one minor problem. I took out the
error checking for now, it works when it compares characters to characters, but not numbers to numbers. I get this #N/A All fields are general z = 5 Do While Range("DCI!A" & z).Value = Date If Range("DCI!J" & z).Value = 0 Then Res = Application.Lookup(Left(Range("DCI!D" & z), 3), Range("HTC!$A$2:$A$81"), Range("HTC!$B$2:$B$81")) Range("DCI!J" & z).Value = Res End If z = z + 1 Loop If I modify this line to Range("DCI!J" & z).Value = CStr(Res), just added CSTR, I get Error 2042, what is this error? "Dthmtlgod" wrote in message ... I am trying to do a lookup, it doesn't error out and it goes through the conditions, but it doesn't update the value. Any ideas? Dim Res as Variant z = 5 Do While Range("DCI!A" & z).Value = Date If CStr(Range("DCI!J" & z).Value) = "000" Then Res = Application.Lookup(Left(Range("DCI!D" & z), 3), Range("HTC!$A$2:$A$200"), Range("HTC!$B$2:$B$200")) If Not IsError(Res) Then Range("DCI!J" & z).Value = Res Else Range("DCI!J" & z).Value = "Not Found-" & Res End If End If z = z + 1 Loop |
All times are GMT +1. The time now is 08:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com