Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default comparing data

Hi. I want to compare the data in two different variables. I does not seem to
manage since one variable is encapsuled i.e. "55518" and the other is plain
i.e. 55518. I have defined one of the variables as Variant but it does not
help.

Set rng1 = Worksheets("Indata").Cells.Find("Date", LookIn:=xlValues)
If rng1 Is Nothing Then
MsgBox ("Datum (date) kan ej hittas!")
Else
i = 0
Do Until IsEmpty(rng1.Offset(i + 1, 0)) = True
If rng1.Offset(i + 1, 0).Value= startDatumArr(1) Then
strTeststartDatumAddress = rng1.Offset(i + 1, 0)
i = i + 1
Else
i = i + 1
End If
The problem is comparing rng1.Offset(i + 1, 0).Value with startDatumArr(1).
The latter is defined as Variant. PLease any help is very much appreciated as
well as needed!!!!!!!!!!!!
The problem is comparing
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default comparing data

Hi April27,

If rng1.Offset(i + 1, 0).Value= startDatumArr(1) Then


Try:

If rng1.Offset(i + 1, 0).Text= startDatumArr(1) Then


---
Regards,
Norman



"april27" wrote in message
...
Hi. I want to compare the data in two different variables. I does not seem
to
manage since one variable is encapsuled i.e. "55518" and the other is
plain
i.e. 55518. I have defined one of the variables as Variant but it does not
help.

Set rng1 = Worksheets("Indata").Cells.Find("Date", LookIn:=xlValues)
If rng1 Is Nothing Then
MsgBox ("Datum (date) kan ej hittas!")
Else
i = 0
Do Until IsEmpty(rng1.Offset(i + 1, 0)) = True
If rng1.Offset(i + 1, 0).Value= startDatumArr(1) Then
strTeststartDatumAddress = rng1.Offset(i + 1, 0)
i = i + 1
Else
i = i + 1
End If
The problem is comparing rng1.Offset(i + 1, 0).Value with
startDatumArr(1).
The latter is defined as Variant. PLease any help is very much appreciated
as
well as needed!!!!!!!!!!!!
The problem is comparing



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default comparing data

Try

val(rng1.Offset(i + 1, 0).Value)= val(startDatumArr(1) )

april27 wrote:
Hi. I want to compare the data in two different variables. I does not seem to
manage since one variable is encapsuled i.e. "55518" and the other is plain
i.e. 55518. I have defined one of the variables as Variant but it does not
help.

Set rng1 = Worksheets("Indata").Cells.Find("Date", LookIn:=xlValues)
If rng1 Is Nothing Then
MsgBox ("Datum (date) kan ej hittas!")
Else
i = 0
Do Until IsEmpty(rng1.Offset(i + 1, 0)) = True
If rng1.Offset(i + 1, 0).Value= startDatumArr(1) Then
strTeststartDatumAddress = rng1.Offset(i + 1, 0)
i = i + 1
Else
i = i + 1
End If
The problem is comparing rng1.Offset(i + 1, 0).Value with startDatumArr(1).
The latter is defined as Variant. PLease any help is very much appreciated as
well as needed!!!!!!!!!!!!
The problem is comparing


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default comparing data


hi
to find out exactly what is happening by comparing the two values I'd
use a line like:

msgbox rng1.Offset(i + 1, 0).Value & startDatumArr(1)
or
activesheet.range("some empty cell").value = rng1.Offset(i + 1,
0).Value
activesheet.range("some empty cell + 1").value = startDatumArr(1)

Then compare the two values as the issue may be caused by extra spaces
(if so, try using the TRIM function) or other non-printing characters
in the cells.

hth
Rob Brockett
always learning & the best way to learn is to experience...


--
broro183
------------------------------------------------------------------------
broro183's Profile: http://www.excelforum.com/member.php...o&userid=30068
View this thread: http://www.excelforum.com/showthread...hreadid=553545

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
comparing two columns of data and return unique data in another co ExcelUSER Excel Discussion (Misc queries) 6 June 18th 09 02:10 PM
Comparing data between sheets, and copying rows with data Fleone Excel Programming 1 June 2nd 06 06:54 PM
help comparing two sets od data to find the odd data matsgullis Excel Worksheet Functions 2 January 12th 06 01:52 AM
comparing lists of data to remove duplicate data Tom Excel Discussion (Misc queries) 2 October 13th 05 06:16 PM
Comparing data in two columns and highlighting the data David Kinsley Excel Worksheet Functions 6 January 4th 05 06:01 PM


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