J
johnboy
hi all,
A small problem with date value in an addin spreadsheet.
I have a holiday calendar for my department in the form of a spreadsheet
which uses formulas to calculate dates for each month. This spreadsheet is
part of an addin which the user access via a vba userform. The application
works fine on my desktop and returns correct date values. However when I
transfer application to my laptop date value for year shows 1900?
code I use in UserForm_Initialize is to determine last month of holiday year
is:
Private Sub UserForm_Initialize()
Dim startweek As Date
Dim endmonth As Date
'holiday year is same as FY so we need to
'ensure calendar is set for current financial year (FY)
With ThisWorkbook.Worksheets("FormData")
ThisWorkbook.Worksheets("YearlyCalendar").Range("A1").Value = _
.Range("J2").Value
DBFile = .Range("D21").Value
End With
Application.ScreenUpdating = False
Set DBWB = Workbooks.Open(DBFile, ReadOnly:=True, Password:=Passwrd)
'set date variables
startweek = ThisWorkbook.Worksheets("FormData").Range("K8").Value
endmonth = ThisWorkbook.Worksheets("YearlyCalendar").Range("S36").Value
etc etc
variable endmonth = the end of the holiday year - lets say December 2006.
on my desktop, the expression Year(endmonth) returns 2006 but 1900 on my
laptop?? Both machines run XP / office 2003 with all updates.
Can anyone tell me what I need to do to correct this please?
Many thanks
A small problem with date value in an addin spreadsheet.
I have a holiday calendar for my department in the form of a spreadsheet
which uses formulas to calculate dates for each month. This spreadsheet is
part of an addin which the user access via a vba userform. The application
works fine on my desktop and returns correct date values. However when I
transfer application to my laptop date value for year shows 1900?
code I use in UserForm_Initialize is to determine last month of holiday year
is:
Private Sub UserForm_Initialize()
Dim startweek As Date
Dim endmonth As Date
'holiday year is same as FY so we need to
'ensure calendar is set for current financial year (FY)
With ThisWorkbook.Worksheets("FormData")
ThisWorkbook.Worksheets("YearlyCalendar").Range("A1").Value = _
.Range("J2").Value
DBFile = .Range("D21").Value
End With
Application.ScreenUpdating = False
Set DBWB = Workbooks.Open(DBFile, ReadOnly:=True, Password:=Passwrd)
'set date variables
startweek = ThisWorkbook.Worksheets("FormData").Range("K8").Value
endmonth = ThisWorkbook.Worksheets("YearlyCalendar").Range("S36").Value
etc etc
variable endmonth = the end of the holiday year - lets say December 2006.
on my desktop, the expression Year(endmonth) returns 2006 but 1900 on my
laptop?? Both machines run XP / office 2003 with all updates.
Can anyone tell me what I need to do to correct this please?
Many thanks