View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default variable given by user

Try:

Sub demo()
Dim d As Date, r As Range
d = InputBox("Enter date: ")
Set r = Nothing
For i = 1 To 65536
If Intersect(Cells(i, 1), ActiveSheet.UsedRange) Is Nothing Then
Exit For
End If
If Cells(i, 1).Value = d Then
If r Is Nothing Then
Set r = Cells(i, 1).EntireRow
Else
Set r = Union(r, Cells(i, 1).EntireRow)
End If
End If
Next
r.Select
End Sub
--
Gary's Student


"Alberto Pinto" wrote:

Hi!

How can i programatically select cells that correspond to user input data
(such as date).
Ie, i want to ask a user a date and then programatically select all rows
that have that date value at column A.

Thanks in advance.