ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how do i create a macro that would check the contents of cells (https://www.excelbanter.com/excel-discussion-misc-queries/62499-how-do-i-create-macro-would-check-contents-cells.html)

Jade

how do i create a macro that would check the contents of cells
 
Hi, I am stcuk on Excel VB. I am trying to create a macro that when run would
check to see if there is an 'X' in 6 specific cells on a row(the cells are
next to each other), there is an X in all of them it would then display a msg
saying 'not possible', else it would not doing anything. I hope i did pass
the problem across in a sensible manner. Thanks for helping.

Elkar

how do i create a macro that would check the contents of cells
 
You wouldn't need to use VB for this. You could just use Data Validation.
Select your 6 cells, then select "Data" from the menu bar, then select
"Validation..."

In the ALLOW box, select "Custom"
Then in the FORMULA box, enter: =NOT(AND($A$1:$F$1="X"))

Of course, change the cell references to match your needs. You can then
change the error messages to whatever you want.

HTH,
Elkar


"Jade" wrote:

Hi, I am stcuk on Excel VB. I am trying to create a macro that when run would
check to see if there is an 'X' in 6 specific cells on a row(the cells are
next to each other), there is an X in all of them it would then display a msg
saying 'not possible', else it would not doing anything. I hope i did pass
the problem across in a sensible manner. Thanks for helping.



All times are GMT +1. The time now is 06:51 AM.

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