Need Help Counting Blank Cells in a Dynamic Range

monicamarie

Board Regular
Joined
Sep 2, 2008
Messages
72
Office Version
  1. 365
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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try:

Code:
Sub test()


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


End Sub

Cheers

Soggy
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,614
Members
449,039
Latest member
Mbone Mathonsi

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