#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 79
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 524
Default 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/
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"