# compare values in a cell in and Excel file

A section from a macro I have is posted below.  I'm trying to compare the value in byte 1 of a cell in column A with byte 2 of the same cell.  How would I modify this code? As it is now, I'm thinking it's comparing byte 1 with both bytes 1 and 2, which would be wrong.  i  is an index

If ((Left\$(Cells(i,1,1) =  (Left\$(Cells(i,1,2)) Then..........
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
it seems to me that the first error is a syntax error, there are too few ')' at the end of the expression, the second error is the function Cells do not acept three arguments like you are using, just two (row and column)
Commented:
If (Left\$(Cells(i,1),1) = Mid\$(Cells(i,1), 2, 1)) Then

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
If (Left\$(Cells(i,1),1) =  Right\$(Left\$(Cells(i,1),2),1) Then.......... ?
Author Commented:
thanks.  i knew it had to involve MID.  didn't know how to set it up though.
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.