making excel recognize it's 20XX not 19XX

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
707
Office Version
  1. 365
  2. 2010
is there a simple way to do this so that it's not PC dependent ? change the settings within the workbook? rather not use formulas
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
is there a simple way to do this so that it's not PC dependent ? change the settings within the workbook? rather not use formulas

looks like it needs to a formula of some sort....so im seeking a macro to do that instead
 
Upvote 0
Can you provide some more details of exactly what you are trying to do?
Do you want a macro that automatically makes dates entered into a certain range on a certain sheet year 20xx?
 
Upvote 0
Can you provide some more details of exactly what you are trying to do?
Do you want a macro that automatically makes dates entered into a certain range on a certain sheet year 20xx?

In addition to Joe4's question above, is there a particular sheet and range that your dates can be in or are you wanting a general fix for any sheet in the workbook inside of any cell on the sheet?
 
Upvote 0
Can you provide some more details of exactly what you are trying to do?
Do you want a macro that automatically makes dates entered into a certain range on a certain sheet year 20xx?
yes exactly ..and
only two columns ...f and g in sheets repo, retail , MBs abs prov , bill , and ba only
 
Upvote 0
only two columns ...f and g in sheets repo, retail , MBs abs prov , bill , and ba only
Give this workbook event code a try (it will automatically make all date years be in the 2000's when they are entered into a cell in Column F or G on the indicated sheets)...
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
  If Target.CountLarge > 1 Then Exit Sub
  If UBound(Filter(Array("repo", "retail", "MBs abs prov", "bill", "ba"), Sh.Name, True, vbTextCompare)) > -1 Then
    If Target.Column = 6 Or Target.Column = 7 Then
      If Year(Target.Value) < 2000 Then Target.Value = DateAdd("yyyy", 100, Target.Value)
    End If
  End If
End Sub

HOW TO INSTALL Event Code
------------------------------------
If you are new to workbook event code procedures, they are easy to install. Go into the VBA editor (ALT+F11) and look at the small windows to the left... find the one titled "Project-VBA Project" and double-click the entry in it named "ThisWorkbook"... that will open the workbook's code window. This will open up the code window for the workbook. Copy/Paste the above event code into that code window. That's it... the code will now operate automatically whenever a date is entered in Column F or G on any of the indicated worksheets. Note... if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0
Give this workbook event code a try (it will automatically make all date years be in the 2000's when they are entered into a cell in Column F or G on the indicated sheets)...
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
  If Target.CountLarge > 1 Then Exit Sub
  If UBound(Filter(Array("repo", "retail", "MBs abs prov", "bill", "ba"), Sh.Name, True, vbTextCompare)) > -1 Then
    If Target.Column = 6 Or Target.Column = 7 Then
      If Year(Target.Value) < 2000 Then Target.Value = DateAdd("yyyy", 100, Target.Value)
    End If
  End If
End Sub

HOW TO INSTALL Event Code
------------------------------------
If you are new to workbook event code procedures, they are easy to install. Go into the VBA editor (ALT+F11) and look at the small windows to the left... find the one titled "Project-VBA Project" and double-click the entry in it named "ThisWorkbook"... that will open the workbook's code window. This will open up the code window for the workbook. Copy/Paste the above event code into that code window. That's it... the code will now operate automatically whenever a date is entered in Column F or G on any of the indicated worksheets. Note... if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

thanks let me give this a try
 
Upvote 0
does the trick

jsut fyi....it's no big deal, but the only way I can clear the dates is by highlight both of them then pressing delete (or I delete the entire row).

if i just enter a date in one colum (eg column F) and try to delete the cell , it turns into 12/30/99 (regardless of the date) and I can't delete it. no big deal, but just again fyi.
 
Last edited:
Upvote 0
There is a Windows setting to handle this.

Click Control Panel > Time & language > Under "Related settings" on the right: Additional date, time, & regional settings > Change date, time, or number formats > Additional settings > Click the Date tab > and in the Calendar section, scroll the number until it says 2099.

They certainly buried it deep enough.
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,229
Members
448,879
Latest member
VanGirl

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