View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
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