Find a variable in a selection

Solved/Closed
Squando - Mar 11, 2009 at 06:49 AM
 Squando - Mar 12, 2009 at 05:16 AM
Hello,

This is probably maddeningly simple or completely the wrong way to do things. I have data added each day and I was wanting to add a button that basically jumps to todays date and then copies data to the attached row. Copying is fine but so far however I can't even select the date.
Column A has the dates which can change, but will always contain today. C3=Today() . I have tried to set aVab, but I am a complete novice and can't find the answer to this simple query. I seem to always get error 91 object variable not set thingy.

    Dim aVab As Date
    aVab = Range("C3").Value
        
    Columns("A:A").Select
    Selection.Find(What:=aVab, After:=ActiveCell, LookIn:=xlValues, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, MatchFormat:=False).Activate
    ActiveCell.Select


Please help. I have been trawling through the VB help and these forums.
Everyone seems very helpful and I have found many helpful pointers but not the answer to this.

Thank you very much

Squando

1 response

If the date [Today())] will appear in the column one time and you want to select that cell, this will do the trick.
Hope this helps!

Dim aVab
Dim c As Range
aVab = Range("C3").Value


For Each c In Range("A1:A65536")

If c = aVab Then
c.Select

End If

Next c
2
Cheers Wutup.

As I suspected you have made it all so simple.
Thanks a lot.

Squando ;)
0