Find next empty row ?

theta

Well-known Member
Joined
Jun 9, 2009
Messages
960
Hi

Anybody got a simple macro to find the next empty row, and make active cell column A of this row?

Also want it so that it only looks for empty rows AFTER row 14

Also, I have a seperate macro to input some formulas, how would I make it so that it will only run if the current row is higher than 14 ?

Help appreciated

T
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
This code is meant as a tutorial, perhaps you can modify to suit your needs..

Code:
Sub foo()
Dim nbr As Long 'nbr = Next blank row number
nbr = Range("A" & Rows.Count).End(xlUp).Row + 1
If nbr <= 14 Then
MsgBox "Your next Blank row is " & nbr & " , which is 14 or less"
Else
MsgBox "Your next blank row is " & nbr
End If
End Sub
 
Upvote 0
Great, ill take a look. Think this uses column A only...but can adjust to see if a row range A:T is blank

Thanks!
 
Upvote 0
Hmmm....still a bit stuck. Want to find the first row where the entire ROW is blank. This tutorial is using the contents of column A to determine a clean row

?
 
Upvote 0
or


Code:
With ActiveSheet.UsedRange
      .Find(What:="", After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
End With
 
Upvote 0
Hi, Luke
You could try this:-
Code:
[COLOR=navy]Sub[/COLOR] MG05Aug55
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range
[COLOR=navy]Set[/COLOR] Rng = Range("A1:A1000")
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
 [COLOR=navy]With[/COLOR] Application
    [COLOR=navy]If[/COLOR] Dn.Row > 14 And Len(Trim(Join(.Transpose(.Transpose(Dn.Resize(, Columns.Count)))))) = 0 [COLOR=navy]Then[/COLOR]
        MsgBox "Row " & Dn.Row
        [COLOR=navy]Exit[/COLOR] [COLOR=navy]Sub[/COLOR]
    [COLOR=navy]End[/COLOR] If
 [COLOR=navy]End[/COLOR] With
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
 
Upvote 0
or


Code:
With ActiveSheet.UsedRange
      .Find(What:="", After:=.Cells([COLOR=red][B]15[/B][/COLOR], 1), LookIn:=xlValues, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
End With

this (modified) code finds the first empty cell, starting from row 14, not the entire column.
 
Upvote 0
Hi, Luke
The best thing to do is is to test code for the result you want.
My code looks at each row after row 14, it joins all the values in each row, then trims the loose Spaces and then counts whats left. If it = 0 then the row is empty.
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,211,528
Messages
6,102,363
Members
447,794
Latest member
rajmungur

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