ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro Help (https://www.excelbanter.com/excel-worksheet-functions/145869-macro-help.html)

Angie

Macro Help
 
Can anyone please help with writing a macro to check the following:

If sheet1!a4:af4 < sheet2!a4:af4 then
msgbox("error")

Thanks

Pete_UK

Macro Help
 
This formula:

=SUMPRODUCT((Sheet1!A4:AF4=Sheet2!A4:AF4)*1)

will return the value 32 if every cell in Sheet1!a4:af4 is equal to
the corresponding cell in Sheet2!a4:af4 (including blanks). If one
cell is different then 31 is returned, if two cells differ then 30 is
returned and so on.

So, you could record a macro while you type this formula in a cell
somewhere to get the syntax, and then embody it in an If Then Else
checking to see if the value is less than 32 to trigger your message.
You could use the value in an amended message to indicate how many
errors there are.

Hope this helps.

Pete

On Jun 8, 9:11 pm, Angie wrote:
Can anyone please help with writing a macro to check the following:

If sheet1!a4:af4 < sheet2!a4:af4 then
msgbox("error")

Thanks




Stan Brown

Macro Help
 
Fri, 8 Jun 2007 13:11:01 -0700 from Angie
:
Can anyone please help with writing a macro to check the following:

If sheet1!a4:af4 < sheet2!a4:af4 then
msgbox("error")


Is this a homework problem? Please tell us what you have tried,
specifically.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/


All times are GMT +1. The time now is 04:03 AM.

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