Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with my UDF jlclyde Excel Discussion (Misc queries) 4 October 24th 08 03:06 PM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
wHAT AM i DOING wrong DMB Excel Worksheet Functions 3 December 27th 05 05:41 PM
What am I doing wrong? jewels Excel Worksheet Functions 8 December 8th 05 02:04 PM
what's wrong? active_x[_13_] Excel Programming 1 September 29th 03 07:12 AM


All times are GMT +1. The time now is 04:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"