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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

hedrijw

Board Regular
Joined
Jun 17, 2002
Messages
210
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
 

Forum statistics

Threads
1,144,050
Messages
5,722,234
Members
422,417
Latest member
Johhny

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
Top