ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   countnonblank (https://www.excelbanter.com/excel-discussion-misc-queries/75285-countnonblank.html)

famdamly

countnonblank
 

How does this work? I'm trying to come up with a macro that determines
the row of the first blank cell in a column. Any help would be
appreciated.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=519034


davesexcel

countnonblank
 

Sub Tst2()
Dim varnbrows As Double
Range("A1").Select
varnbrows = Selection.CurrentRegion.Rows.Count
If Selection.Value = "" Then
Exit Sub
ElseIf Selection.Offset(1, 0).Value = "" Then
Selection.Offset(1, 0).Select
Else
Selection.Offset(varnbrows, 0).Select
End If
End Sub

this will take you to the first empty cell in column A

copy and paste it into a module make a button assign this macro to it


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=519034



All times are GMT +1. The time now is 11:19 PM.

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