Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Glitch in code some where, i think ?

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11 July
2006.


Why ?

Is there an error in the code?

Corey....


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Glitch in code some where, i think ?

You might try it this way and see if it still does it. I basically put the
cell containing the date into a variable container and knocked out some
extraneous stuff. The key thing is using the variable container.

Sub callUpdates()
Sheets("Enter - Exit").Activate ' Sheet name
Dim ws As Worksheet, myDate As Date
myDate = Range("$E$2").Value
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Activate
Range("E2") = myDate + 7
Next
Sheets("Enter - Exit").Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

"Corey" wrote:

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11 July
2006.


Why ?

Is there an error in the code?

Corey....



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Glitch in code some where, i think ?

If the cell actually contains a date serial number and not a string/text
which looks a date, then it should make no difference how it is formatted.

I suspect if you qualify your ranges (particularly if this is in a sheet
module rather than a general module) and use Value2, it will correct the
problem.

Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
With ws.Range("E2") ' Date value displayed a 31 October 2006
if isdate(.Value) then
.Value2 = .Value2 + 7
else
msgbox "Cell E2 on " & ws.name & " is not a date"
End if
End with
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub



--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
How to i code that format ?

"alondon" wrote in message
...
Corey,

There is no error in the code, but the format of the E2 cell on each
sheet must be custom format "dd mmmm yyyy" to work consistently. Note,
you were wise to always use the European dating convention.

Allan P. London, CPA




"Corey" wrote in message
...
Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
.Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July 2006.


Why ?

Is there an error in the code?

Corey....









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Glitch in code some where, i think ?

I still get the code jumping from 31 October 2006 to 11 July 2006 for some
reason????

But i have another macro that displays a userform that also has displayed
the value in Cell E2,
and it Shows 7 November 2006, whereas the worksheet E2 value shows 11 July
2006.

Why ?
Corey....
"JLGWhiz" wrote in message
...
You might try it this way and see if it still does it. I basically put
the
cell containing the date into a variable container and knocked out some
extraneous stuff. The key thing is using the variable container.

Sub callUpdates()
Sheets("Enter - Exit").Activate ' Sheet name
Dim ws As Worksheet, myDate As Date
myDate = Range("$E$2").Value
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Activate
Range("E2") = myDate + 7
Next
Sheets("Enter - Exit").Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

"Corey" wrote:

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July
2006.


Why ?

Is there an error in the code?

Corey....





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Glitch in code some where, i think ?

Tom,
Value did the same and jumped to 11 July 2006 when supposedly adding 7 days
to 31 October 2006???

Corey....
"Tom Ogilvy" wrote in message
...
If the cell actually contains a date serial number and not a string/text
which looks a date, then it should make no difference how it is formatted.

I suspect if you qualify your ranges (particularly if this is in a sheet
module rather than a general module) and use Value2, it will correct the
problem.

Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
With ws.Range("E2") ' Date value displayed a 31 October 2006
if isdate(.Value) then
.Value2 = .Value2 + 7
else
msgbox "Cell E2 on " & ws.name & " is not a date"
End if
End with
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub



--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
How to i code that format ?

"alondon" wrote in message
...
Corey,

There is no error in the code, but the format of the E2 cell on each
sheet must be custom format "dd mmmm yyyy" to work consistently. Note,
you were wise to always use the European dating convention.

Allan P. London, CPA




"Corey" wrote in message
...
Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
.Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July 2006.


Why ?

Is there an error in the code?

Corey....









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Glitch in code some where, i think ?

are you sure you're not getting the values of E2 from 2 different sheets?

--


Gary


"Corey" wrote in message
...
I still get the code jumping from 31 October 2006 to 11 July 2006 for some
reason????

But i have another macro that displays a userform that also has displayed the
value in Cell E2,
and it Shows 7 November 2006, whereas the worksheet E2 value shows 11 July
2006.

Why ?
Corey....
"JLGWhiz" wrote in message
...
You might try it this way and see if it still does it. I basically put the
cell containing the date into a variable container and knocked out some
extraneous stuff. The key thing is using the variable container.

Sub callUpdates()
Sheets("Enter - Exit").Activate ' Sheet name
Dim ws As Worksheet, myDate As Date
myDate = Range("$E$2").Value
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Activate
Range("E2") = myDate + 7
Next
Sheets("Enter - Exit").Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

"Corey" wrote:

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11 July
2006.


Why ?

Is there an error in the code?

Corey....







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Glitch in code some where, i think ?

format the cell to General and report the value stored there.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
I still get the code jumping from 31 October 2006 to 11 July 2006 for some
reason????

But i have another macro that displays a userform that also has displayed
the value in Cell E2,
and it Shows 7 November 2006, whereas the worksheet E2 value shows 11 July
2006.

Why ?
Corey....
"JLGWhiz" wrote in message
...
You might try it this way and see if it still does it. I basically put
the
cell containing the date into a variable container and knocked out some
extraneous stuff. The key thing is using the variable container.

Sub callUpdates()
Sheets("Enter - Exit").Activate ' Sheet name
Dim ws As Worksheet, myDate As Date
myDate = Range("$E$2").Value
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Activate
Range("E2") = myDate + 7
Next
Sheets("Enter - Exit").Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

"Corey" wrote:

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July
2006.


Why ?

Is there an error in the code?

Corey....







  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Glitch in code some where, i think ?

I didn't say value.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
Tom,
Value did the same and jumped to 11 July 2006 when supposedly adding 7
days to 31 October 2006???

Corey....
"Tom Ogilvy" wrote in message
...
If the cell actually contains a date serial number and not a string/text
which looks a date, then it should make no difference how it is
formatted.

I suspect if you qualify your ranges (particularly if this is in a sheet
module rather than a general module) and use Value2, it will correct the
problem.

Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
With ws.Range("E2") ' Date value displayed a 31 October 2006
if isdate(.Value) then
.Value2 = .Value2 + 7
else
msgbox "Cell E2 on " & ws.name & " is not a date"
End if
End with
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub



--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
How to i code that format ?

"alondon" wrote in message
...
Corey,

There is no error in the code, but the format of the E2 cell on each
sheet must be custom format "dd mmmm yyyy" to work consistently. Note,
you were wise to always use the European dating convention.

Allan P. London, CPA




"Corey" wrote in message
...
Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
.Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July 2006.


Why ?

Is there an error in the code?

Corey....













  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Glitch in code some where, i think ?

39021



"Tom Ogilvy" wrote in message
...
format the cell to General and report the value stored there.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
I still get the code jumping from 31 October 2006 to 11 July 2006 for some
reason????

But i have another macro that displays a userform that also has displayed
the value in Cell E2,
and it Shows 7 November 2006, whereas the worksheet E2 value shows 11
July 2006.

Why ?
Corey....
"JLGWhiz" wrote in message
...
You might try it this way and see if it still does it. I basically put
the
cell containing the date into a variable container and knocked out some
extraneous stuff. The key thing is using the variable container.

Sub callUpdates()
Sheets("Enter - Exit").Activate ' Sheet name
Dim ws As Worksheet, myDate As Date
myDate = Range("$E$2").Value
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Activate
Range("E2") = myDate + 7
Next
Sheets("Enter - Exit").Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

"Corey" wrote:

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July
2006.


Why ?

Is there an error in the code?

Corey....









  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Glitch in code some where, i think ?

I don't have a solution, but does the fact that we are looking for 07/11/06
and getting 11/07/06 look like a US/rest-of-the-world date conflict to anyone
else?

"Corey" wrote:

I still get the code jumping from 31 October 2006 to 11 July 2006 for some
reason????

But i have another macro that displays a userform that also has displayed
the value in Cell E2,
and it Shows 7 November 2006, whereas the worksheet E2 value shows 11 July
2006.

Why ?
Corey....
"JLGWhiz" wrote in message
...
You might try it this way and see if it still does it. I basically put
the
cell containing the date into a variable container and knocked out some
extraneous stuff. The key thing is using the variable container.

Sub callUpdates()
Sheets("Enter - Exit").Activate ' Sheet name
Dim ws As Worksheet, myDate As Date
myDate = Range("$E$2").Value
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Activate
Range("E2") = myDate + 7
Next
Sheets("Enter - Exit").Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

"Corey" wrote:

Have posted this eror before with no replies.

################################################## ###########
Sub callUpdates()
Sheets("Enter - Exit").Select ' Sheet name
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Application.Worksheets
ws.Select
With Range("E2") ' Date value displayed a 31 October 2006
..Value = Range("E2").Value + 7 ' Should add 7 days to currently
displayed
date value
End With
Next
Sheets("Enter - Exit").Select
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
################################################## ##########


The above code suppose to add 7 days to a date value in Cell E2,
Yet sometimes it works fine,
yet other times it jumps 6 months backwards from 31 October 2006 - 11
July
2006.


Why ?

Is there an error in the code?

Corey....






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
merged cells - code glitch Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 9 October 10th 07 09:27 PM
Is there a Glitch in this code or what ? Not consistant results !!! Corey Excel Programming 2 November 10th 06 06:52 AM
Strange glitch davegb Excel Programming 3 October 25th 06 08:59 PM
Random glitch? Marty Excel Programming 2 June 1st 05 03:25 PM
Code Glitch from version to version Shawn Excel Programming 2 November 24th 04 02:45 AM


All times are GMT +1. The time now is 06:53 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"