ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compare blocks of cells (https://www.excelbanter.com/excel-programming/384631-compare-blocks-cells.html)

Rominall

Compare blocks of cells
 
Is there a quick way to compare a block of cells in a row without doing
something like
a = activecell.value
B= activecell.offset(0,1).value
c = activecell.offset(0,2).value

Different worksheet.
Range(A1).activate
if activecell.value = a and activecell.offset(0,1).value = b and
activecell.offset(0,2).value = c then

'code

end if

I ask because I need to compare two worksheets and there's about 8 columns
to match and it just seems really cumbersome.

Madhan

Compare blocks of cells
 
Hi, you need to change your strategy for comparison as follows. Write a VBA
code that does the following,
1. Loops across columns
1.1. Loops within the cells in the column
1.1.1. check if content in cell1 of worksheet1 matches the content in cell2
of worksheet2.


"Rominall" wrote:

Is there a quick way to compare a block of cells in a row without doing
something like
a = activecell.value
B= activecell.offset(0,1).value
c = activecell.offset(0,2).value

Different worksheet.
Range(A1).activate
if activecell.value = a and activecell.offset(0,1).value = b and
activecell.offset(0,2).value = c then

'code

end if

I ask because I need to compare two worksheets and there's about 8 columns
to match and it just seems really cumbersome.



All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com