Comparing Strings with VBA code

ThatGuyNamedDean

New Member
Joined
Apr 16, 2015
Messages
9
I have a large data set with multiple columns and a significant number of rows. Each column has a string with a number in the same place but the number is different for each column. Due to typo errors I want to compare each column to the first column, which I know is correct. Is there a way for me to compare a cell with the cell next to it but only using a certain part of the text within the cell? An example is posted below of what I'm looking at.

ColumnA - abcd$1$abcd.ABCD


ColumnB - abcd$5$abcd.ABCD


I would ultimately like to write a code to highlight a cell if the number is different from the cell above it or if any of the letters are different from the cell to the left of it.

I've compared two cells before but using the value in the entire cell.

Thank you in advance for your help!
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,380
If everything in row (2) should be the same as everything in row (1) and
If everything in row (3) should be the same as everything in row (2) and etc. etc.

And if:

If everything in column (2) should be the same as everything in column (1) and
If everything in column (3) should be the same as everything in column (2) etc. etc.

Sounds like to me everything in your entire sheet should be exactly the same
 

ThatGuyNamedDean

New Member
Joined
Apr 16, 2015
Messages
9
Not quite...

Each number is the same in each column and all the letters are the same in each row.

Which means that numbers vary by column and letters vary by row and why I want to compare only the letters to the column next to it and the numbers to the row above it.
 

Forum statistics

Threads
1,084,753
Messages
5,379,658
Members
401,620
Latest member
Ankur Teotia

Some videos you may like

This Week's Hot Topics

  • VBA code giving errors and stopping Excel
    Hello Experts, I have this code being used to loop through files in a file path, and copy specific data to another sheet. It is giving me several...
  • Disable MsgBox message
    Morning, I have a userform where if i leave a ComboBox empty i see a MsgBox warning me that i must enter an invoice number. It is this MsgBox i...
  • Macro Recorder into VBA, Copy Paste Data Filled Cells
    Hi Everyone, I have a macro recorder file that takes a selection of data, copies, then pastes into a new sheet on ("A2:B2") The issue is my...
  • Number format changes while pasting into a cell
    Hi, I am trying to paste a number 180204524303 from an email to an excel cell, however, whenever i try to do so , the the paste value appears as...
  • Collating data
    Hello all. Could someone please help. I am trying to pull all column data from multiple sheets (24 I total so far) into 1 master sheet without...
  • Sum Multiple Columns Based on Multiple Criteria
    I am trying to consolidate data by summing columns G through M based on material, plant, vendor, and fiscal year being identical. The period does...
Top