View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Armelle Aaserød Armelle Aaserød is offline
external usenet poster
 
Posts: 3
Default Check i a value is in a Range

Hi,

I have a worksheet on which I have some week numbers entered in Column A.
Within a Sub I use an InputBox to get the user to type in a week number.
What I would like to do is to check whether the week number typed in by the
user is in Column A. If it isn't I would like to ask the user to enter a
valid week number and show the InputBox again. If the week number entered is
in Column A, then I read a value from a Named Range and put in in Column B
beside the week number entered

What I did was a simple Sub but I have no validation so it's a bit poor :

Weeknum = InputBox("Please enter your week number")

Do
i = i + 1

Loop Until Range("A" & i).Value = Weeknum


Range("B" & i).Value = MyStock
Range("B" & i).NumberFormat = "#,##0.0000"

I tried writing something with Cells.Find but it didn't work I got a type
mismatch error.
Can someone help me with this ?

Thanks in advance,

Armelle Aaserød