today's date in two places

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
826
Office Version
  1. 365
Platform
  1. Windows
Hi,
I’m trying to add code to have the cursor go to today’s date. The problem is that I have it in two places. One in a un- hidden column and one in a hidden column. On opening the sheet, the cursor tries to find the closest one to AI, even if’s it a hidden column. I want it to go to the un-hidden one on opening the sheet and only go to the hidden one when I un-hide the columns.
I ranged name the un-hidden column “weekly” and the hidden column with the dates “daily”
I added the line in red to the following codes:
HTML:
Private Sub workbook_open()
 Application.Goto Reference:="R5C1"
    ActiveWindow.FreezePanes = True
    Application.Goto Reference:="weekly"
    gotodateday
End Sub
And:
HTML:
Sub unhide()
ActiveWindow.FreezePanes = False
 Application.Goto Reference:="R5C1"
    ActiveWindow.FreezePanes = True
Application.Goto Reference:="R600C100"
Application.Goto Reference:="days"
Application.ScreenUpdating = False
Range("A1").Select
Range("weight").Select
Selection.EntireColumn.Hidden = False
Application.Goto Reference:="daily"
gotodateday
ActiveCell.Offset(0, 1).Range("A1").Select
Application.ScreenUpdating = True
ActiveWindow.ScrollRow = ActiveCell.Row - 1
End Sub
But I can’t get to work.
Without the new lines, on opening , I have to move to the right date.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
<o:p></o:p>
Mike
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,224,586
Messages
6,179,712
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top