Find date in row and move to cell

M

Maver1ck666

I will try and explain this as best as I can but please forgive me if I fail.

I have a date range in row 2 starting in column e and runing through to cell
IR2. I then have a list of tasks in column a staring in row 4.

There is a command button linked to a macro that will insert a new task in
the middle of the existing list of tasks and creates some subtotals etc but
what I would like it also to do is remember the row the active cell is in,
look up todays date in the range and move to that location ready for input.

Any ideas please?

Kind regards,
Mav
 
J

Jacob Skaria

Try the below

Sub Macro()
Dim lngCol As Long
'your other code
lngCol = Cells.Find(What:="4/28/2010", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlWhole).Column
Application.Goto Cells(2, lngCol), True
End Sub
 
J

Jacob Skaria

Oops...I missed the activecell Row....Try the modified one..

Sub Macro()
Dim lngRow As Long, lngCol As Long
lngRow = ActiveCell.Row

'your other code here

lngCol = Cells.Find(What:="4/28/2010", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlWhole).Column
Cells(lngRow, lngCol).Activate
End Sub
 
M

Maver1ck666

Excellent, cheers for that Jacob!

Jacob Skaria said:
Oops...I missed the activecell Row....Try the modified one..

Sub Macro()
Dim lngRow As Long, lngCol As Long
lngRow = ActiveCell.Row

'your other code here

lngCol = Cells.Find(What:="4/28/2010", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlWhole).Column
Cells(lngRow, lngCol).Activate
End Sub
 
J

Jacob Skaria

I just noticed; I have hardcoded the date...You can try the below..

Sub Macro()
Dim lngRow As Long, lngCol As Long
lngRow = ActiveCell.Row

'your other code here

lngCol = Cells.Find(What:=Date, After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlWhole).Column
Cells(lngRow, lngCol).Activate
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top