Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default scrolling to a specific cell

sorry - having a bit of a mind-block. I have a worksheet with a column of
dates and would like to auto-scroll to the current date (if available) in
column B, every time the sheet is activated (so that the row is visible for
entering fresh data)... i know i should be able to do this, but just can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default scrolling to a specific cell

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a column of
dates and would like to auto-scroll to the current date (if available) in
column B, every time the sheet is activated (so that the row is visible

for
entering fresh data)... i know i should be able to do this, but just can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default scrolling to a specific cell

Sorry missed the scrolling automatically part, so please use this instead :

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select
ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Amit
"Amit Shanker" wrote in message
...
Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a column

of
dates and would like to auto-scroll to the current date (if available)

in
column B, every time the sheet is activated (so that the row is visible

for
entering fresh data)... i know i should be able to do this, but just

can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default scrolling to a specific cell

Use the sheet activate event:

Dim rng as Range
set rng = me.Range(me.Cells(1,1),me.Cells(me.rows.count,1).E nd(xlup))
res = Application.Match(clng(date),rng,0)
if not iserror(res) then
rng(res).Select
End if

--
Regards,
Tom Ogilvy


"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a column of
dates and would like to auto-scroll to the current date (if available) in
column B, every time the sheet is activated (so that the row is visible

for
entering fresh data)... i know i should be able to do this, but just can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default scrolling to a specific cell

Thank you Amit (& Tom)

this'll do nicely... for the record i did fine yet another way, but it
involved a 'do...until' loop and was very inefficient.

cheers from foggy, wet England,

tim

"Amit Shanker" wrote in message
...
Sorry missed the scrolling automatically part, so please use this instead

:

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select
ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Amit
"Amit Shanker" wrote in message
...
Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a

column
of
dates and would like to auto-scroll to the current date (if available)

in
column B, every time the sheet is activated (so that the row is

visible
for
entering fresh data)... i know i should be able to do this, but just

can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default scrolling to a specific cell

Note that in most versions of Excel Cell.Find(Date) doesn't work very
reliably.

--
Regards,
Tom Ogilvy

"Amit Shanker" wrote in message
...
Sorry missed the scrolling automatically part, so please use this instead

:

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select
ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Amit
"Amit Shanker" wrote in message
...
Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a

column
of
dates and would like to auto-scroll to the current date (if available)

in
column B, every time the sheet is activated (so that the row is

visible
for
entering fresh data)... i know i should be able to do this, but just

can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default scrolling to a specific cell

Tom, any idea why ? Would like to understand this better.

Thanks,
Amit


"Tom Ogilvy" wrote in message
...
Note that in most versions of Excel Cell.Find(Date) doesn't work very
reliably.

--
Regards,
Tom Ogilvy

"Amit Shanker" wrote in message
...
Sorry missed the scrolling automatically part, so please use this

instead
:

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select
ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Amit
"Amit Shanker" wrote in message
...
Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a

column
of
dates and would like to auto-scroll to the current date (if

available)
in
column B, every time the sheet is activated (so that the row is

visible
for
entering fresh data)... i know i should be able to do this, but just

can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default scrolling to a specific cell

I can't say why - I don't have the code for the Find method. I just know
that in my experience, match as I show, is much more reliable (never seen it
fail if there is a match - but even with that, I have to convert to long for
the search). On the other hand, I have plenty of problems with Find not
finding dates when they exist.

Some have suggest that for the lookin parameter xlValues works while others
say xlformulas work. I haven't found a consistent solution (and I imagine
this would be affected by how the value in the cell is produced). Tim
doesn't set any parameters, so such usage is a crap shoot as to what the
last setting the user applied was/is.

On the other hand, I work mostly in xl97 and xl2000, so it may not be a
problem for you.

--
Regards,
Tom Ogilvy



"Amit Shanker" wrote in message
...
Tom, any idea why ? Would like to understand this better.

Thanks,
Amit


"Tom Ogilvy" wrote in message
...
Note that in most versions of Excel Cell.Find(Date) doesn't work very
reliably.

--
Regards,
Tom Ogilvy

"Amit Shanker" wrote in message
...
Sorry missed the scrolling automatically part, so please use this

instead
:

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select
ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Amit
"Amit Shanker" wrote in message
...
Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a

column
of
dates and would like to auto-scroll to the current date (if

available)
in
column B, every time the sheet is activated (so that the row is

visible
for
entering fresh data)... i know i should be able to do this, but

just
can't
think how... its been a long day! Can anyone give me the answer?

tia,

tim












  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default scrolling to a specific cell

OK thanks for the explanation, Tom; appreciate it. I am using Office XP so
thankfully this has not been a problem, but when providing solutions for
previous versions of Excel, definitely something to keep in mind.

Amit


"Tom Ogilvy" wrote in message
...
I can't say why - I don't have the code for the Find method. I just know
that in my experience, match as I show, is much more reliable (never seen

it
fail if there is a match - but even with that, I have to convert to long

for
the search). On the other hand, I have plenty of problems with Find not
finding dates when they exist.

Some have suggest that for the lookin parameter xlValues works while

others
say xlformulas work. I haven't found a consistent solution (and I imagine
this would be affected by how the value in the cell is produced). Tim
doesn't set any parameters, so such usage is a crap shoot as to what the
last setting the user applied was/is.

On the other hand, I work mostly in xl97 and xl2000, so it may not be a
problem for you.

--
Regards,
Tom Ogilvy



"Amit Shanker" wrote in message
...
Tom, any idea why ? Would like to understand this better.

Thanks,
Amit


"Tom Ogilvy" wrote in message
...
Note that in most versions of Excel Cell.Find(Date) doesn't work

very
reliably.

--
Regards,
Tom Ogilvy

"Amit Shanker" wrote in message
...
Sorry missed the scrolling automatically part, so please use this

instead
:

Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select
ActiveWindow.ScrollRow = ActiveCell.Row

End Sub

Amit
"Amit Shanker" wrote in message
...
Option Explicit

Private Sub Worksheet_Activate()

Cells.Find(Date).Select

End Sub

Hope this helps,
Amit

"Tim Marsh" wrote in message
...
sorry - having a bit of a mind-block. I have a worksheet with a
column
of
dates and would like to auto-scroll to the current date (if

available)
in
column B, every time the sheet is activated (so that the row is
visible
for
entering fresh data)... i know i should be able to do this, but

just
can't
think how... its been a long day! Can anyone give me the

answer?

tia,

tim














  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default scrolling to a specific cell

Speculative...might it have something to do with the difference between
Value and Value2? If A1 contains a date (1/1/2003), then
MsgBox TypeName([a1].Value) & ", " & TypeName([a1].Value2)
returns Date, Double.

In the code below, the 2nd Find faults:

Sub testIt2()
Dim x As Date, y As Long
x = #1/1/2003#: y = x
MsgBox x & ", " & y
MsgBox Cells.Find(x).Address
MsgBox Cells.Find(y).Address
End Sub

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I can't say why - I don't have the code for the Find method. I just know
that in my experience, match as I show, is much more reliable (never seen it
fail if there is a match - but even with that, I have to convert to long for
the search). On the other hand, I have plenty of problems with Find not
finding dates when they exist.

Some have suggest that for the lookin parameter xlValues works while others
say xlformulas work. I haven't found a consistent solution (and I imagine
this would be affected by how the value in the cell is produced). Tim
doesn't set any parameters, so such usage is a crap shoot as to what the
last setting the user applied was/is.

On the other hand, I work mostly in xl97 and xl2000, so it may not be a
problem for you.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
very large WB-what can I do to find a specific tab w/o scrolling? Remington Excel Discussion (Misc queries) 5 July 2nd 09 09:05 PM
Excel- smooth scrolling (instead of 'snap' scrolling) scooterbaga Setting up and Configuration of Excel 2 April 24th 08 02:16 PM
Vertical scrolling...jumps rather than smooth scrolling Miller Man Excel Discussion (Misc queries) 2 January 23rd 07 07:11 PM
Live Scrolling/Real-Time /Smooth Scrolling doesn't work for me in Excel, even 2007 beta [email protected] Excel Discussion (Misc queries) 2 July 21st 06 01:21 AM
Live Scrolling/Real-Time /Smooth Scrolling doesn't work for me in Excel 2003 [email protected] Excel Discussion (Misc queries) 0 May 12th 06 03:15 AM


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"