ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find date in row and move to cell (https://www.excelbanter.com/excel-programming/442108-find-date-row-move-cell.html)

Maver1ck666

Find date in row and move to cell
 
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

Jacob Skaria

Find date in row and move to cell
 
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

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

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


Jacob Skaria

Find date in row and move to cell
 
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

--
Jacob (MVP - Excel)


"Jacob Skaria" wrote:

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

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

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


Maver1ck666

Find date in row and move to cell
 
Excellent, cheers for that Jacob!

"Jacob Skaria" wrote:

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

--
Jacob (MVP - Excel)


"Jacob Skaria" wrote:

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

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

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


Jacob Skaria

Find date in row and move to cell
 
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

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

Excellent, cheers for that Jacob!

"Jacob Skaria" wrote:

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

--
Jacob (MVP - Excel)


"Jacob Skaria" wrote:

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

--
Jacob (MVP - Excel)


"Maver1ck666" wrote:

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



All times are GMT +1. The time now is 11:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com