ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   open work book to current date (https://www.excelbanter.com/excel-programming/296399-open-work-book-current-date.html)

Smeesh

open work book to current date
 
I have Excel 200 in the office and have created a projector booking form. I
want to improve the worksheet by getting it to open at the current date.

The worksheet (column a) has listed in it the date. Can anyone help with
some vb (or other method - I am not fussy) to open the sheet at the current
system date.

Thanks in advance
m



Bob Flanagan

open work book to current date
 

M, you can do it this way:

Dim T As Long
T = Now()
r = Application.Match(T, Columns(1), True)
Application.Goto Cells(r, 1)


assuming that you are on the sheet containing the dates and they are in
column A.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel



"Smeesh" wrote in message
...
I have Excel 200 in the office and have created a projector booking form.

I
want to improve the worksheet by getting it to open at the current date.

The worksheet (column a) has listed in it the date. Can anyone help with
some vb (or other method - I am not fussy) to open the sheet at the

current
system date.

Thanks in advance
m





ross

open work book to current date
 
Easy!

the formuals are
=Today()
of for a little more info
=now(),

these can be called from vba in the usally way

Enjoy
Ross

Smeesh

open work book to current date
 
Hi Ross (and anybody else who wants to help!),

Thanks for the reply, however I had tried the Today() subfunction and could
not get it to work.

The VBA I have is:
Private Sub Workbook_Open()
Sheets("bookingsheet").Activate
Range((B4:B1454)=Today()).Select
End Sub

I get a compile error because of the :. Am I on the wrong track?

"ross" wrote in message
om...
Easy!

the formuals are
=Today()
of for a little more info
=now(),

these can be called from vba in the usally way

Enjoy
Ross




Suzette[_2_]

open work book to current date
 
Try date()
Now() gives you information about the date and time
Date() gives you just date information.


"Smeesh" wrote in message
...
Hi Ross (and anybody else who wants to help!),

Thanks for the reply, however I had tried the Today() subfunction and

could
not get it to work.

The VBA I have is:
Private Sub Workbook_Open()
Sheets("bookingsheet").Activate
Range((B4:B1454)=Today()).Select
End Sub

I get a compile error because of the :. Am I on the wrong track?

"ross" wrote in message
om...
Easy!

the formuals are
=Today()
of for a little more info
=now(),

these can be called from vba in the usally way

Enjoy
Ross






Bill Kuunders

open work book to current date
 
Bob Flanigans answer was very close.
had to add the Dim r as long line and used the "date" rather then "today"
Tried it out putting the macro in the "this workbook" section.
It works! Thanks for the question I'll be using this myself.
Regards
Bill K

Private Sub Workbook_Open()
Dim r As Long
Dim T As Long
T = Date
r = Application.Match(T, Columns(1), True)
Application.Goto Cells(r, 1)
End Sub


"Suzette" wrote in message
...
Try date()
Now() gives you information about the date and time
Date() gives you just date information.


"Smeesh" wrote in message
...
Hi Ross (and anybody else who wants to help!),

Thanks for the reply, however I had tried the Today() subfunction and

could
not get it to work.

The VBA I have is:
Private Sub Workbook_Open()
Sheets("bookingsheet").Activate
Range((B4:B1454)=Today()).Select
End Sub

I get a compile error because of the :. Am I on the wrong track?

"ross" wrote in message
om...
Easy!

the formuals are
=Today()
of for a little more info
=now(),

these can be called from vba in the usally way

Enjoy
Ross









All times are GMT +1. The time now is 06:16 AM.

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