Find 1st empty row in data base issue

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. Windows
I need the code I have for finding first empty row to ignore the data i have in column A. I have data in row 1 also. Im not sure how to adjust the code below. Thanks for the help as always

Code:
iRow = ws.Cells.Find(What:="*", SearchOrder:=x1Rows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You say ignore column A. If you don't have any holes in data making blank cells possible. I often use application.worksheetfunction.counta(RANGE), on a column that I know has data in it every row that is used. Say A has dates all the way down, and B is value on that date, never holes in the middle, i use this regularly.
 
Upvote 0
Thanks for you help. This is some code that was in this workbook when I started using it. I dont know much at all about VBA. Could you possibly edit the code I have to show how it should look? Thanks
 
Upvote 0
I have fairly basic VBA knowledge, so there may be a more efficient way. If there are no gaps like I mentioned in column B (Can change this to any column without Gaps). I would do:

Code:
irow = application.worksheetfunction.counta(Range("B:B")) + 1
 
Upvote 0
on a column that I know has data in it every row that is used

This will find the last row in Col. B and increment by one regardless:

Code:
irow = Cells(Rows.Count, "B").End(xlUp).Row + 1

Your original code finds the last row in whatever column it exists and increments it by one. It will error out though if the sheet is blank.

HTH

Robert
 
Upvote 0
Another option, based on your original code
Code:
irow = Ws.Range("B:H").Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
This will find the last row in columns B to H
 
Upvote 0

Forum statistics

Threads
1,224,833
Messages
6,181,242
Members
453,026
Latest member
cknader

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