comparing data

A

april27

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
 
B

broro183

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top