Using If statement to check cell contents.

Closed
Tiny - May 25, 2010 at 09:54 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - May 25, 2010 at 04:19 PM
Hello, I have two sets of data one in a new spreadsheet with a suffix added and the the second in a master file with both (standard part numbers and some with suffix versions.

I am trying to compare both sets of base data against each other in order to check if the base number exists in the master file. I have a variable value named "FindString" to represent the new data in one workbook, against a variable cell position in the Master file Workbook in Excel. I have declared the "Findstring" as a string from the New file, where the ActiveCell.Formula is looking through the Master file.
This is the formula I am using in VBA to check both files;

'If ((ActiveCell.FormulaR1C1 = "=LEFT(RC1,11)") = FindString) _
Then

Although when both of these cells match contents I am not recieving a "True" response from this logical test.

Can you help?
I am new to VBA and learning as I go.

Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
May 25, 2010 at 04:19 PM
Not sure what you are asking.

'If ((ActiveCell.FormulaR1C1 = "=LEFT(RC1,11)") = FindString) _

this part is saying if the formula in the active cell is Left(An, 11) = find string, where n is the row number. If you had meant to compare the left 11 characters of the cell with find string then you need to call as

If (LEFT(ActiveCell, 11) = FindString)


SInce you are saying you are learnign VB, may be it would help if you post more snippet of your code. Or post book at some shared site like https://authentification.site , http://wikisend.com/ , http://www.editgrid.com etc and post back here the link