Need Help Counting Blank Cells in a Dynamic Range

monicamarie

Board Regular
Joined
Sep 2, 2008
Messages
66
I'm trying to count all of the empty cells in a dynamic range but am having a hard time finding the correct code.
The example below shows how my data is laid out. The dynamic range is always in colum B. So one data list might end at B12 and another might end at B90 etc. I just want to count the number of empty cells and return the value in C2. Can someone help me with this as a VBA code?

Thank you
CARD NUMBER</SPAN>CARDSTATUS</SPAN>
xxxxxxxxxxxx1234</SPAN>ACTV</SPAN>
xxxxxxxxxxxx1235</SPAN>ACTV</SPAN>
xxxxxxxxxxxx1236</SPAN>ACTV</SPAN>
xxxxxxxxxxxx1247</SPAN>
xxxxxxxxxxxx1248</SPAN>
xxxxxxxxxxxx1249</SPAN>
xxxxxxxxxxxx1259</SPAN>
xxxxxxxxxxxx1260</SPAN>ACTV</SPAN>
xxxxxxxxxxxx1265</SPAN>ACTV</SPAN>
xxxxxxxxxxxx1266</SPAN>ACTV</SPAN>
xxxxxxxxxxxx1267</SPAN>ACTV</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL></COLGROUP>
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Soggy

Board Regular
Joined
May 16, 2012
Messages
188
Try:

Code:
Sub test()


lastrow = ActiveSheet.Range("A2").End(xlDown).Row
Range("C2").Formula = "=countblank(B2:B" & lastrow & ")"


End Sub

Cheers

Soggy
 

Watch MrExcel Video

Forum statistics

Threads
1,130,307
Messages
5,641,436
Members
417,209
Latest member
Agbarker

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