Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 :) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Susan,
Am Sat, 22 Dec 2012 12:56:51 -0800 (PST) schrieb 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? try: sDate = Date That works for all language settings Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oh MY!!!! I didn't dim sDate?!
<whacks forehead Thank you, Claus. I will fix that. Thank goodness I included the dim statements for you! I also changed the formatting on Column A to a format that is not affected by individual computer settings - I don't know if that will make any difference or not. Susan :) On Dec 22, 4:09*pm, Claus Busch wrote: Hi Susan, Am Sat, 22 Dec 2012 12:56:51 -0800 (PST) schrieb 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? try: sDate = Date That works for all language settings Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Whew, I'm not completely stupid... I have
Public sDate As String, sCategory As String in another module. I will change it to Public sDate as Date Susan On Dec 22, 4:09*pm, Claus Busch wrote: Hi Susan, Am Sat, 22 Dec 2012 12:56:51 -0800 (PST) schrieb 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? try: sDate = Date That works for all language settings Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Public sDate as Date
doesn't work. It says it can't find the date. sDate as String worked (on my computer). Susan :/ On Dec 22, 4:51*pm, Susan wrote: Whew, I'm not completely stupid... I have Public sDate As String, sCategory As String in another module. I will change it to Public sDate as Date Susan On Dec 22, 4:09*pm, Claus Busch wrote: Hi Susan, Am Sat, 22 Dec 2012 12:56:51 -0800 (PST) schrieb 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? try: sDate = Date That works for all language settings Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi susan,
Am Sat, 22 Dec 2012 13:54:07 -0800 (PST) schrieb Susan: Public sDate as Date doesn't work. It says it can't find the date. sDate as String worked (on my computer). what I meant is to change sDate = Format(Now, "dd/mm/yy") to sDate =Date Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, works for me, let's see if it works for my client! I'll let you know.
Thanks! Susan :) On Sunday, December 23, 2012 4:09:48 AM UTC-5, Claus Busch wrote: Hi susan, Am Sat, 22 Dec 2012 13:54:07 -0800 (PST) schrieb Susan: Public sDate as Date doesn't work. It says it can't find the date. sDate as String worked (on my computer). what I meant is to change sDate = Format(Now, "dd/mm/yy") to sDate =Date Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
permanent conversion of 1904 date format to 1900 date format | Excel Worksheet Functions | |||
finding a date/time in a list that is closest to an existing date/ | Excel Discussion (Misc queries) | |||
Finding the Monday date based on a different date in same week | Excel Worksheet Functions | |||
code to convert date from TEXT format (03-02) to DATE format (200203) | Excel Programming | |||
Change a date in text format xx.xx.20xx to a recognised date format | Excel Programming |