ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel counting empty cells until first filled one (https://www.excelbanter.com/excel-discussion-misc-queries/242960-excel-counting-empty-cells-until-first-filled-one.html)

Rafael Martinez

Excel counting empty cells until first filled one
 
Hello, I need to count how many empty cells there are before hitting first cell with data, I guess there is a way to make a code, macro for this...

Thanks

Rafael

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorials...vices-usi.aspx

Bernie Deitrick

Excel counting empty cells until first filled one
 
Rafael,

Sub TryNow()
Dim myR As Range
Set myR = Range("A2")

If myR.Value = "" Then
MsgBox Range(myR, myR.End(xlDown)(0)).Rows.Count
Else
MsgBox "No blank rows"
End If
End Sub

HTH,
Bernie
MS Excel MVP


<Rafael Martinez wrote in message ...
Hello, I need to count how many empty cells there are before hitting first cell with data, I guess
there is a way to make a code, macro for this...

Thanks

Rafael

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorials...vices-usi.aspx




francis

Excel counting empty cells until first filled one
 
How about this

assuming your range is in A2 to A10,
=COUNTBLANK(A2:A10)
or

=COUNTIF(A2:A10,"")

--
Hope this is helpful

Pls click the Yes button below if this post provide answer you have asked

Thank You

cheers, francis




"Rafael Martinez" wrote:

Hello, I need to count how many empty cells there are before hitting first cell with data, I guess there is a way to make a code, macro for this...

Thanks

Rafael

EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorials...vices-usi.aspx



All times are GMT +1. The time now is 10:58 PM.

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