View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AZ Analog AZ Analog is offline
external usenet poster
 
Posts: 3
Default For Each Next woes

Good day!
I'm having difficulty with the proper syntax for the following operation:

Dim AskDate as Date
Dim Target as Variant

For Each Target in [B17:AK48]
AskDate = InputBox("Enter Date")
If Target = AskDate then
Target . Select
Exit For
Else
Endif
Next Target


Here is what I am trying to do. The user inputs a date, the macro searches
the defined array for that user-input date. If the date is found, the
selection becomes that particular cell. If the date is not found, the user
is prompted to enter a date in again. This process repeats until an input
date matches a date within the given array. I've messed with syntax for a
couple hours, so I'm wondering if someone would be kind enough to give me a
push in the right direction. Thank you for your time!