troubleshooting Question

VBA  trying to compare number as text to number, must convert

Avatar of ohmetw
ohmetw asked on
Microsoft Applications
3 Comments1 Solution407 ViewsLast Modified:
Having an issue with a very large spreadsheet where some numbers are formatted as text and som values are strings.  Trying to cycle thru 1st sheet one row at a time and comparing these cells to values on the second sheet so I can do some logic in a vba routine.

The issue is that out of the 800,000 rows of data, over 100,000 are not comparing properly because numbers formatted as text in the first sheet are not "equal" to the numbers in the second sheet.

I was going to try to convert everything to a string like:
If  STR(sheet1.cells(r,c) = STR(sheet2.cells(s,d)) then....

but then I get errors because some cells actually contain strings...and trying to make a string... a string ....gave me an error.

so, not sure how to do this.  wanted to just test if it's a string and if not, make it a string.  I think that would work.  any ideas?

here are some of the things I am trying to work with and am having trouble comparing due to formats:

W1011223
4544556
3433454 (as text)


ASKER CERTIFIED SOLUTION
VipulKadia

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros