Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Variant/Double?!?

Hi,

I have an Excel sheet that updates productionnumbers and compares them
against yesterdays predictions. In this sheet I got a problem, in the code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("MÃ¥l_V").Cells(3, 2).Value Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("MÃ¥l_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And if I put a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become equal. But the
next day I will have the same problem. How do I fix this?

Peter Arvidsson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Variant/Double?!?

Try.....

If Cstr(Sheets(Blad).Cells(3, 1).Value) < Sheets("MÃ¥l_V").Cells(3, 2).Value
Then

"PeterArvidsson" wrote:

Hi,

I have an Excel sheet that updates productionnumbers and compares them
against yesterdays predictions. In this sheet I got a problem, in the code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("MÃ¥l_V").Cells(3, 2).Value Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("MÃ¥l_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And if I put a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become equal. But the
next day I will have the same problem. How do I fix this?

Peter Arvidsson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Variant/Double?!?

Maybe try this

If CStr(Sheets(Blad).Cells(3, 1).Value) < _
CStr(Sheets("Mål_V").Cells(3, 2).Value) Then


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"PeterArvidsson" wrote in message
...
Hi,

I have an Excel sheet that updates productionnumbers and compares them
against yesterdays predictions. In this sheet I got a problem, in the code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("Mål_V").Cells(3, 2).Value

Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("Mål_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And if I put

a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become equal. But

the
next day I will have the same problem. How do I fix this?

Peter Arvidsson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Variant/Double?!?

Thank you, works like a charm.

What did Cstr do to the code?

/Peter


"Nigel RS" skrev:

Try.....

If Cstr(Sheets(Blad).Cells(3, 1).Value) < Sheets("MÃ¥l_V").Cells(3, 2).Value
Then

"PeterArvidsson" wrote:

Hi,

I have an Excel sheet that updates productionnumbers and compares them
against yesterdays predictions. In this sheet I got a problem, in the code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("MÃ¥l_V").Cells(3, 2).Value Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("MÃ¥l_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And if I put a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become equal. But the
next day I will have the same problem. How do I fix this?

Peter Arvidsson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Variant/Double?!?

Casts the variable to string, forces string comparison. See my version, a
little more robust.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"PeterArvidsson" wrote in message
...
Thank you, works like a charm.

What did Cstr do to the code?

/Peter


"Nigel RS" skrev:

Try.....

If Cstr(Sheets(Blad).Cells(3, 1).Value) < Sheets("Mål_V").Cells(3,

2).Value
Then

"PeterArvidsson" wrote:

Hi,

I have an Excel sheet that updates productionnumbers and compares them
against yesterdays predictions. In this sheet I got a problem, in the

code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("Mål_V").Cells(3, 2).Value

Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("Mål_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And if I

put a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become equal.

But the
next day I will have the same problem. How do I fix this?

Peter Arvidsson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Variant/Double?!?

If you want something even more robust then trim each string in case of those
'hidden' spaces that can creep in!


If Trim(CStr(Sheets(Blad).Cells(3, 1).Value)) < _
Trim(CStr(Sheets("MÃ¥l_V").Cells(3, 2).Value)) Then



"Bob Phillips" wrote:

Casts the variable to string, forces string comparison. See my version, a
little more robust.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"PeterArvidsson" wrote in message
...
Thank you, works like a charm.

What did Cstr do to the code?

/Peter


"Nigel RS" skrev:

Try.....

If Cstr(Sheets(Blad).Cells(3, 1).Value) < Sheets("MÃ¥l_V").Cells(3,

2).Value
Then

"PeterArvidsson" wrote:

Hi,

I have an Excel sheet that updates productionnumbers and compares them
against yesterdays predictions. In this sheet I got a problem, in the

code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("MÃ¥l_V").Cells(3, 2).Value

Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("MÃ¥l_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And if I

put a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become equal.

But the
next day I will have the same problem. How do I fix this?

Peter Arvidsson




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Variant/Double?!?

You should then also replace any Chat(160) with "", much data web copied has
them.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Nigel RS" wrote in message
...
If you want something even more robust then trim each string in case of

those
'hidden' spaces that can creep in!


If Trim(CStr(Sheets(Blad).Cells(3, 1).Value)) < _
Trim(CStr(Sheets("Mål_V").Cells(3, 2).Value)) Then



"Bob Phillips" wrote:

Casts the variable to string, forces string comparison. See my version,

a
little more robust.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"PeterArvidsson" wrote in

message
...
Thank you, works like a charm.

What did Cstr do to the code?

/Peter


"Nigel RS" skrev:

Try.....

If Cstr(Sheets(Blad).Cells(3, 1).Value) < Sheets("Mål_V").Cells(3,

2).Value
Then

"PeterArvidsson" wrote:

Hi,

I have an Excel sheet that updates productionnumbers and compares

them
against yesterdays predictions. In this sheet I got a problem, in

the
code
below.

If Sheets(Blad).Cells(3, 1).Value < Sheets("Mål_V").Cells(3,

2).Value
Then

The value that excel presents is:
Sheets(Blad).Cells(3, 1).Value : 20060531 : Variant/Double
Sheets("Mål_V").Cells(3, 2).Value : "20060531" : Variant/String

I have tried to change so that both to have the form "Text". And

if I
put a
' in front "Sheets(Blad).Cells(3, 1).Value" then they become

equal.
But the
next day I will have the same problem. How do I fix this?

Peter Arvidsson






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
double axis, double problem (i hope only to me) kitcho Charts and Charting in Excel 1 December 30th 06 12:52 AM
Variant owl527[_5_] Excel Programming 2 October 14th 05 09:37 PM
Variant as matrix curious Excel Programming 5 June 2nd 04 04:18 PM
Declaring As Variant, Changing to Double? k Excel Programming 7 April 13th 04 01:06 PM
Testing if Variant is Range or Double? Don Wiss Excel Programming 3 January 26th 04 12:35 AM


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

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

About Us

"It's about Microsoft Excel"