ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GOTO Using the ()NOW Function Q (https://www.excelbanter.com/excel-programming/315855-goto-using-now-function-q.html)

John[_78_]

GOTO Using the ()NOW Function Q
 
I am trying to go to the cell, 2 columns to the right of the cell the
current day is displayed in.

I have a list of days of the year in column A, input starts on Column C. I
want to initiate the user to go to the 'Current day' via the ()NOW function.
Part of the code I wish to use, which will freeze panes etc is below, but
not sure the syntax for including the ()NOW function

Thanks

Application.Goto Range("Schedule!A1"), True
ActiveCell.Offset(2, 0).Select
ActiveWindow.FreezePanes = True



Bob Phillips[_6_]

GOTO Using the ()NOW Function Q
 
You can't use Goto. Look at Find in Help.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John" wrote in message
...
I am trying to go to the cell, 2 columns to the right of the cell the
current day is displayed in.

I have a list of days of the year in column A, input starts on Column C. I
want to initiate the user to go to the 'Current day' via the ()NOW

function.
Part of the code I wish to use, which will freeze panes etc is below, but
not sure the syntax for including the ()NOW function

Thanks

Application.Goto Range("Schedule!A1"), True
ActiveCell.Offset(2, 0).Select
ActiveWindow.FreezePanes = True





Dave Peterson[_4_]

GOTO Using the ()NOW Function Q
 
I assumed that the dates were in a single column (A) on a worksheet named
Sheet1:

Option Explicit
Sub testme()

Dim res As Variant
Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
res = Application.Match(CLng(Date), myRng, 0)

If IsError(res) Then
'not found, what should happen?
Else
Application.Goto myRng(res), scroll:=True
myRng(res).Offset(0, 2).Select
ActiveWindow.FreezePanes = True
End If
End With
End Sub



John wrote:

I am trying to go to the cell, 2 columns to the right of the cell the
current day is displayed in.

I have a list of days of the year in column A, input starts on Column C. I
want to initiate the user to go to the 'Current day' via the ()NOW function.
Part of the code I wish to use, which will freeze panes etc is below, but
not sure the syntax for including the ()NOW function

Thanks

Application.Goto Range("Schedule!A1"), True
ActiveCell.Offset(2, 0).Select
ActiveWindow.FreezePanes = True


--

Dave Peterson


John

GOTO Using the ()NOW Function Q
 
Dave thanks for your post

I've copied your code into a module but nothing is happening. Not sure if I
have it within the correct area as the 'Option Explicit' text appears above
another Sub I have, I can't get it within the same sub


"Dave Peterson" wrote in message
...
I assumed that the dates were in a single column (A) on a worksheet named
Sheet1:

Option Explicit
Sub testme()

Dim res As Variant
Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
res = Application.Match(CLng(Date), myRng, 0)

If IsError(res) Then
'not found, what should happen?
Else
Application.Goto myRng(res), scroll:=True
myRng(res).Offset(0, 2).Select
ActiveWindow.FreezePanes = True
End If
End With
End Sub



John wrote:

I am trying to go to the cell, 2 columns to the right of the cell the
current day is displayed in.

I have a list of days of the year in column A, input starts on Column C.

I
want to initiate the user to go to the 'Current day' via the ()NOW

function.
Part of the code I wish to use, which will freeze panes etc is below,

but
not sure the syntax for including the ()NOW function

Thanks

Application.Goto Range("Schedule!A1"), True
ActiveCell.Offset(2, 0).Select
ActiveWindow.FreezePanes = True


--

Dave Peterson





All times are GMT +1. The time now is 10:30 AM.

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