S
Susan
This macro is written in 03 VBA and saved in a 97-03 workbook. It
works fine on my XP windows desktop, and works fine on my Windows 7
Professional laptop in Office 2010 when saved as a 97-03 workbook. In
sending to an overseas client (India), however, it keeps bombing out
right at the very beginning because it cannot find the date. As you
see, I have reformulated the date in her copy to dd/mm/yy, (my
original is mm/dd/yy), because I assume her computer defaults to dd/mm/
yy. She tried manually formatting Column A to dd/mm/yy, but
apparently that hasn't worked. Any suggestions?
Option Explicit
Sub Button2_Click()
Set wbWorking = ActiveWorkbook
Set wsData = wbWorking.Worksheets("Data")
Set wsCalculations = wbWorking.Worksheets("Calculations")
Set wsMSTime = wbWorking.Worksheets("MS Time")
Set wsOtherTime = wbWorking.Worksheets("Other Time")
Set rStart = wsCalculations.Range("g5")
Set rEnd = wsCalculations.Range("g6")
Set rBoolean = wsCalculations.Range("a1")
Set rTotalTime = wsCalculations.Range("g9")
On Error GoTo OhMy
If rBoolean = 0 Then
rStart.Value = Now
rStart.NumberFormat = "hh:mm"
rEnd.Value = ""
rEnd.NumberFormat = "hh:mm"
'reset the boolean
rBoolean.Value = 1
Else
rEnd.Value = Now
rEnd.NumberFormat = "hh:mm"
'reset the boolean
rBoolean.Value = 0
'this is the end of adding the end time, now put it in sheet1.
Set rTotalTime = wsCalculations.Range("g9")
LastRow = wsData.Cells(20000, 1).End(xlUp).Row
Set rDate = wsData.Range("a3:a" & LastRow)
sDate = Format(Now, "dd/mm/yy")
Set rFound = rDate.Find(What:=sDate, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If rFound Is Nothing Then
MsgBox "Date not found", vbCritical
Exit Sub
End If
Thank you!
Susan
works fine on my XP windows desktop, and works fine on my Windows 7
Professional laptop in Office 2010 when saved as a 97-03 workbook. In
sending to an overseas client (India), however, it keeps bombing out
right at the very beginning because it cannot find the date. As you
see, I have reformulated the date in her copy to dd/mm/yy, (my
original is mm/dd/yy), because I assume her computer defaults to dd/mm/
yy. She tried manually formatting Column A to dd/mm/yy, but
apparently that hasn't worked. Any suggestions?
Option Explicit
Sub Button2_Click()
Set wbWorking = ActiveWorkbook
Set wsData = wbWorking.Worksheets("Data")
Set wsCalculations = wbWorking.Worksheets("Calculations")
Set wsMSTime = wbWorking.Worksheets("MS Time")
Set wsOtherTime = wbWorking.Worksheets("Other Time")
Set rStart = wsCalculations.Range("g5")
Set rEnd = wsCalculations.Range("g6")
Set rBoolean = wsCalculations.Range("a1")
Set rTotalTime = wsCalculations.Range("g9")
On Error GoTo OhMy
If rBoolean = 0 Then
rStart.Value = Now
rStart.NumberFormat = "hh:mm"
rEnd.Value = ""
rEnd.NumberFormat = "hh:mm"
'reset the boolean
rBoolean.Value = 1
Else
rEnd.Value = Now
rEnd.NumberFormat = "hh:mm"
'reset the boolean
rBoolean.Value = 0
'this is the end of adding the end time, now put it in sheet1.
Set rTotalTime = wsCalculations.Range("g9")
LastRow = wsData.Cells(20000, 1).End(xlUp).Row
Set rDate = wsData.Range("a3:a" & LastRow)
sDate = Format(Now, "dd/mm/yy")
Set rFound = rDate.Find(What:=sDate, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If rFound Is Nothing Then
MsgBox "Date not found", vbCritical
Exit Sub
End If
Thank you!
Susan