Forum Discussion

CarlJakobsson's avatar
CarlJakobsson
Copper Contributor
Oct 21, 2022

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

    • CarlJakobsson's avatar
      CarlJakobsson
      Copper 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 

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        CarlJakobsson 

        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?

    • CarlJakobsson's avatar
      CarlJakobsson
      Copper 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 

  • Sandeeep's avatar
    Sandeeep
    Brass Contributor
    OOOOOOh, 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

Resources