View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Peter Hesselager Peter Hesselager is offline
external usenet poster
 
Posts: 18
Default VLOOKUP in a Macro

You're just the guy !
I only had to use the Range-command to avoid a Type Mismatch - like this

If Application.CountIf(Range("DagNr"), I) < 0 Then

-eeh, now can you also tell me how to go to the A column on the actual Row ?
I Have tried
Selection.End(xlToLeft).Select
but some cells in the row may be empty - so it's not a sure thing


"Jim Thomlinson" wrote:

Countif is probably a better choice than Vlookup. countif is faster for one
thing and a little easier to implement

for I = 170 to 182
IF Application.Countif(DayNr,I)<0 THEN
something
ENDIF
Next

HTH

"Peter Hesselager" wrote:

I can't make the Data_value work

for I = 170 to 182
IF I = VLOOKUP(I, DayNr,1) THEN
something
ENDIF
Next

I = actual daynumber
DayNr is a range of Working day No.

If I substitute "I" with a value ( say 170), it works OK.
The goal is to decide, whether I is a working day or not.

How should it be written ?