Only one occupied cell in column

Delton

Board Regular
Joined
Oct 19, 2002
Messages
66
I am looking for procedure to allow a macro to run only if there is only one or no cells in a range in column "H" populated. All the cells concerned have whole numbers, no text or formulas.

Something like IF ActiveCell(in row "H") is equal to Range(H24:H30525) than allow macro to run. If not, than message (clear other values first)or some action that indicates the macro cannot be run. The active cell will always be in the above range.

I just need there to be no more than one cell in the "H" column within the mentioned range that is populated. This can be by preventing populating more than one cell or by not allowing the macro to run if additional cells are not prevented from having numbers entered into them.
Thank you.
All suggestions are helpful and appreciated. If they don't fit here, they usually find a use in a future situation.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Is this what you need?

If Application.WorksheetFunction.Count([H24:H30525]) > 1 Then Exit Sub

In other words, if there are more than one number value in the range H4:H30525, discontinue subroutine execution
This message was edited by hedrijw on 2002-11-06 08:42
 
Upvote 0

Forum statistics

Threads
1,215,633
Messages
6,125,922
Members
449,274
Latest member
mrcsbenson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top