Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Message Box to Appear if Cell Values In Range Differ
Hi
I am currently pasting worksheet data into a new spreadsheet and all the dates in the cell range C2:C500 should be the same. However from time to time one or two dates may differ. I would like a message box to appear as soon as the data is pasted in to the new sheet if any on the dates in the range should not be identical. Any assistance you could provide would be appreciated. Thanks Monk |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Message Box to Appear if Cell Values In Range Differ
IF Application.COUNTIF(Range("C2:C500"), Range("C2).Value) < Range("C2:C500").Cells.Count Then Msgbox "not all the same" End If -- __________________________________ HTH Bob "Monk" wrote in message ... Hi I am currently pasting worksheet data into a new spreadsheet and all the dates in the cell range C2:C500 should be the same. However from time to time one or two dates may differ. I would like a message box to appear as soon as the data is pasted in to the new sheet if any on the dates in the range should not be identical. Any assistance you could provide would be appreciated. Thanks Monk |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Message Box to Appear if Cell Values In Range Differ
Thanks Bob. This works well but I forgot to advise that within that range
there may be blank cells. Can you please advise how this would be modified to ignore blank cells within that C2:C500 range so that the error message will only appear if data appears within that range? Cheers Monk "Bob Phillips" wrote: IF Application.COUNTIF(Range("C2:C500"), Range("C2).Value) < Range("C2:C500").Cells.Count Then Msgbox "not all the same" End If -- __________________________________ HTH Bob "Monk" wrote in message ... Hi I am currently pasting worksheet data into a new spreadsheet and all the dates in the cell range C2:C500 should be the same. However from time to time one or two dates may differ. I would like a message box to appear as soon as the data is pasted in to the new sheet if any on the dates in the range should not be identical. Any assistance you could provide would be appreciated. Thanks Monk |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Message Box to Appear if Cell Values In Range Differ
Just change it to this
If Application.CountIf(Range("C2:C500"), Range("C2").Value) < _ Application.CountA(Range("C2:C500")) Then MsgBox "not all the same" End If -- __________________________________ HTH Bob "Monk" wrote in message ... Thanks Bob. This works well but I forgot to advise that within that range there may be blank cells. Can you please advise how this would be modified to ignore blank cells within that C2:C500 range so that the error message will only appear if data appears within that range? Cheers Monk "Bob Phillips" wrote: IF Application.COUNTIF(Range("C2:C500"), Range("C2).Value) < Range("C2:C500").Cells.Count Then Msgbox "not all the same" End If -- __________________________________ HTH Bob "Monk" wrote in message ... Hi I am currently pasting worksheet data into a new spreadsheet and all the dates in the cell range C2:C500 should be the same. However from time to time one or two dates may differ. I would like a message box to appear as soon as the data is pasted in to the new sheet if any on the dates in the range should not be identical. Any assistance you could provide would be appreciated. Thanks Monk |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Message Box to Appear if Cell Values In Range Differ
Thanks Bob. Works perfectly. Much appreciated
"Bob Phillips" wrote: Just change it to this If Application.CountIf(Range("C2:C500"), Range("C2").Value) < _ Application.CountA(Range("C2:C500")) Then MsgBox "not all the same" End If -- __________________________________ HTH Bob "Monk" wrote in message ... Thanks Bob. This works well but I forgot to advise that within that range there may be blank cells. Can you please advise how this would be modified to ignore blank cells within that C2:C500 range so that the error message will only appear if data appears within that range? Cheers Monk "Bob Phillips" wrote: IF Application.COUNTIF(Range("C2:C500"), Range("C2).Value) < Range("C2:C500").Cells.Count Then Msgbox "not all the same" End If -- __________________________________ HTH Bob "Monk" wrote in message ... Hi I am currently pasting worksheet data into a new spreadsheet and all the dates in the cell range C2:C500 should be the same. However from time to time one or two dates may differ. I would like a message box to appear as soon as the data is pasted in to the new sheet if any on the dates in the range should not be identical. Any assistance you could provide would be appreciated. Thanks Monk |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Comparing the values in two cells, then counting how many differ | Excel Worksheet Functions | |||
Array formula to display 1 if concatentaed values differ.. | Excel Worksheet Functions | |||
Excel: want header cell sizes to differ from the other sheet cell. | Excel Discussion (Misc queries) | |||
Send the Document, may differ some place due to cell contents... | Excel Discussion (Misc queries) | |||
can I delete entire row if adjacent cell formats differ? | Excel Worksheet Functions |