Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Finding Date in an overseas format

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Finding Date in an overseas format

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Finding Date in an overseas format

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Finding Date in an overseas format

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Finding Date in an overseas format

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Finding Date in an overseas format

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Finding Date in an overseas format

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
finding a date/time in a list that is closest to an existing date/ Jamie Excel Discussion (Misc queries) 1 May 27th 06 08:54 PM
Finding the Monday date based on a different date in same week dandiehl Excel Worksheet Functions 4 April 11th 06 06:03 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"