Thread: Macro Help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default 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