View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike[_103_] Mike[_103_] is offline
external usenet poster
 
Posts: 9
Default Check i a value is in a Range

Armelle Aaserød wrote:
Hi,


Hello Armelle,
try something like this

Sub SearchWeekNumber()
MyStock = 10000.355453
WeekNum = Application.InputBox("Please enter your week number", _
, , , , , , 1)
While WeekNum < 1 Or WeekNum 52
MsgBox "Number has to be between 1 and 52" & vbLf & "Try again"
WeekNum = Application.InputBox("Please enter your week number", _
, , , , , , 1)
Wend

a = Application.Match(Val(WeekNum), Columns(1), False)
If Not (IsError(a)) Then
Cells(a, 2).Value = MyStock
Cells(a, 2).NumberFormat = "#,##0.0000"
Else
MsgBox "The week has NOT been found"
End If

End Sub


Mike,
Luxembourg