Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Version problem?

I have 2 problems which I think are related but have no proof. Let me
explain. The firm I work for operates a number of offices across
scotland and has over 300 staff. There are various different versions
of excel running from 97 up to 2003 and also a number of different
service packs are installed so whilst I'm on 2000 SP-3 some of my
colleagues are on 2000 SR-1. You get the idea.

Lately I have been building models for various parties around the firm
and whilst they work perfectly on my machine the macros often don't
work on other machines.

eg Problem 1 - a macro compares a date to the values in a range of
cells. On some machines the empty cell is being read as an empty
string (ie "") and causing a type mismatch error (due to string being
compared to number) whilst on my machine the empty cell is being read
as zero and it works (number being compared to number).

Relevant code (dDeadlineStart contains a date)...

Dim DeadLineStart As Long
DeadLineStart = Range("dDeadlineStart").Value
If Format(Cells(xloop, yloop).Value, "0") = DeadLineStart

the error happens at the IF statement

Problem 2 - Clicking on a cancel button on a dialog box I created
caused an error then crashed excel. Clicking on the cancel button of a
different dialog box (which I also created) caused the same error and
again crashed excel. Unfortunately I didn't note the error.

Relevant code...

Private Sub cmdCancel()
Unload frmDeleteUnit
End Sub

I am becoming fed up of creating models which operate perfectly on my
machine but not on others. I know its unhelpful not to have the error
for the 2nd problem but if any of you can shed any light on why this
might be happening I'd be grateful.

Thanks in advance

Stuart

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Version problem?

No great insights into the problem, other than it would seem okay, and
advising to always develop on the least version deployed as a fail-safe
technique.

But ...

If Format(Cells(xloop, yloop).Value, "0") = DeadLineStart

is a problem. The format will evaluate to a string, but you are comparing to
a Long, could be problemmatical.

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
I have 2 problems which I think are related but have no proof. Let me
explain. The firm I work for operates a number of offices across
scotland and has over 300 staff. There are various different versions
of excel running from 97 up to 2003 and also a number of different
service packs are installed so whilst I'm on 2000 SP-3 some of my
colleagues are on 2000 SR-1. You get the idea.

Lately I have been building models for various parties around the firm
and whilst they work perfectly on my machine the macros often don't
work on other machines.

eg Problem 1 - a macro compares a date to the values in a range of
cells. On some machines the empty cell is being read as an empty
string (ie "") and causing a type mismatch error (due to string being
compared to number) whilst on my machine the empty cell is being read
as zero and it works (number being compared to number).

Relevant code (dDeadlineStart contains a date)...

Dim DeadLineStart As Long
DeadLineStart = Range("dDeadlineStart").Value
If Format(Cells(xloop, yloop).Value, "0") = DeadLineStart

the error happens at the IF statement

Problem 2 - Clicking on a cancel button on a dialog box I created
caused an error then crashed excel. Clicking on the cancel button of a
different dialog box (which I also created) caused the same error and
again crashed excel. Unfortunately I didn't note the error.

Relevant code...

Private Sub cmdCancel()
Unload frmDeleteUnit
End Sub

I am becoming fed up of creating models which operate perfectly on my
machine but not on others. I know its unhelpful not to have the error
for the 2nd problem but if any of you can shed any light on why this
might be happening I'd be grateful.

Thanks in advance

Stuart



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Version problem?

For problem #1, some machines would be machines with xl97 I would think.
This was a problem in xl97.

Solution is to recognize it and program to take care of it.

If you know your cells will be blanks or contain numbers

Dim DeadLineStart As Long
DeadLineStart = Range("dDeadlineStart").Value
If clng(Format(Cells(xloop, yloop).Value, "0")) = DeadLineStart

if you don't know
Dim sStr as String
Dim DeadLineStart As Long
DeadLineStart = Range("dDeadlineStart").Value
sStr = Format(Cells(xloop, yloop).Value, "0")
if isnumeric(sStr) then
If cln(sStr) = DeadLineStart Then

I suspect you second problem is probably xl97 machines as well. However
unloading a userform should be pretty generic - however, if you have chained
the showing of userforms, that might be more of a problem.

As Bob said, for the greatest chances of success, you should do your
development on xl97 (the lowest version which will use the code).

--
Regards,
Tom Ogilvy



"Bob Phillips" wrote in message
...
No great insights into the problem, other than it would seem okay, and
advising to always develop on the least version deployed as a fail-safe
technique.

But ...

If Format(Cells(xloop, yloop).Value, "0") = DeadLineStart

is a problem. The format will evaluate to a string, but you are comparing

to
a Long, could be problemmatical.

--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
oups.com...
I have 2 problems which I think are related but have no proof. Let me
explain. The firm I work for operates a number of offices across
scotland and has over 300 staff. There are various different versions
of excel running from 97 up to 2003 and also a number of different
service packs are installed so whilst I'm on 2000 SP-3 some of my
colleagues are on 2000 SR-1. You get the idea.

Lately I have been building models for various parties around the firm
and whilst they work perfectly on my machine the macros often don't
work on other machines.

eg Problem 1 - a macro compares a date to the values in a range of
cells. On some machines the empty cell is being read as an empty
string (ie "") and causing a type mismatch error (due to string being
compared to number) whilst on my machine the empty cell is being read
as zero and it works (number being compared to number).

Relevant code (dDeadlineStart contains a date)...

Dim DeadLineStart As Long
DeadLineStart = Range("dDeadlineStart").Value
If Format(Cells(xloop, yloop).Value, "0") = DeadLineStart

the error happens at the IF statement

Problem 2 - Clicking on a cancel button on a dialog box I created
caused an error then crashed excel. Clicking on the cancel button of a
different dialog box (which I also created) caused the same error and
again crashed excel. Unfortunately I didn't note the error.

Relevant code...

Private Sub cmdCancel()
Unload frmDeleteUnit
End Sub

I am becoming fed up of creating models which operate perfectly on my
machine but not on others. I know its unhelpful not to have the error
for the 2nd problem but if any of you can shed any light on why this
might be happening I'd be grateful.

Thanks in advance

Stuart





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Version problem?

Tom/Bob

Thanks for your insights. I like the idea of testing if the cell is
numeric before comparing it to the date. That aught to work a treat.

However your assumption that problem #2 was probably on an xl97 machine
was incorrect (apologies for not specifying that in my original query).
It was actually on an xl 2000 sr-1 machine whilst I am on xl 2000
sp-3. Unless someone advises me otherwise I would have thought that
the service packs would make no difference. So either (a) the service
packs do make a difference and could cause this sort of error or (b)
they don't make a difference and the error is caused by some other
unknown factor. I'd prefer it to be the former as that's easiest to
solve.

Let me know if you have anything you can add to this, as you can tell
I'm pretty much stumped!!!

Kind regards

Stuart

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
Excel Version Problem RemyMaza Excel Discussion (Misc queries) 2 March 27th 08 04:28 PM
Version Problem Mian_Ghous Excel Worksheet Functions 2 November 19th 07 12:31 PM
Version Problem Mian_Ghous Excel Worksheet Functions 0 November 19th 07 05:24 AM
version problem Lisa Excel Discussion (Misc queries) 4 April 1st 05 06:57 PM
VBA version problem UKNewbie Excel Programming 2 October 29th 04 12:24 PM


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

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"