Forum Discussion
CarlJakobsson
Oct 21, 2022Copper Contributor
Difficulty matching cell values
Hello,
I have made a VBA macro that reads cell values into an array and compares with values in another array. If there is a match, an action is taken (not relevant). It works with some exceptions. Sometimes the values are identical but excel does not recognize it. Excel then shifts the value in the cell to one side. I then go in and do a manual control F search and can match the value. I have tried all sorts of cell formats, but I cannot solve the problem.
Does anyone have a clue?
carl
6 Replies
Sort By
Could it be that one value is a number and the other is text that looks like a number?
- CarlJakobssonCopper Contributor
Thanks Hans, but that not it. I tried it. I tried different kinds of cell formatting (text, number, general). All cells have the same formatting. HansVogelaar
Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?
- OliverScheurichGold Contributor
Can you share the code of your macro?
- CarlJakobssonCopper Contributor
Hi. yes I can, but I dont think the problem is in the code. I can see the behaviour in
the cell when I place the cursor in the cell and press enter. Most of the time the content stays in place without moving. In some specific cells the content moves to the far left. OliverScheurich
- SandeeepCopper ContributorOOOOOOh, I kinda did this similar thing just the other day!. Hope I can help. Here's what helped me, https://stackoverflow.com/questions/1796852/ms-excel-2-columns-into-a-2-dimensional-array