VBA check range for matching rows

Cooki

Board Regular
Joined
Jul 31, 2018
Messages
86
Hi All

I have some data that has been input into a system and i have the export from that system as well.

I need to check if the data has been input correctly or not

Workbook1 has that data that has been input into the system

Workbook2 has the export.

There are multiple tabs on each, but each tab is called the same.

On workbook1 data starts from A2 and goes to K400

Workbook2 data starts from B2 and goes to L400

So basically i need to make sure that each set of row data has been into into workbook2 correctly and if not highlight red or something to show where the error is.

TIA

Rich
 
Oh right got ya, no there is nothing unqiue in any of the coulmns. As the data will be changing each month..

Ive managed to do it with a formula, but thought VBA would make it automated.

Dam

Thanks anyways
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Rich (BB code):
Set sh1 = master.M3633E17
Set sh2 = output.M3633E17

These will not yield valid sheet references and that is why you got the 424 error.

Try.
VBA Code:
Set sh1 = Workbooks("Master.xlsm").Sheets("M3633E17")
Set sh2 = Workbooks("output.xlsx").Sheets("M3633E17")
You might need to change the file extensions on the workbooks.
 
Upvote 0
Rich (BB code):
Set sh1 = master.M3633E17
Set sh2 = output.M3633E17

These will not yield valid sheet references and that is why you got the 424 error.

Try.
VBA Code:
Set sh1 = Workbooks("Master.xlsm").Sheets("M3633E17")
Set sh2 = Workbooks("output.xlsx").Sheets("M3633E17")
You might need to change the file extensions on the workbooks.
Getting runtime error 9

Subscript out of range
 
Upvote 0
Did you read post #12? You have to use the correct syntax to set the variables for your worksheets.
The syntax for the workbook is: Workbooks("workbook name.extension")
The syntax for the sheet is: Sheets("sheet name")
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top