determine empty row

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
hi i am reading a code and part of it is to determine an empty row, please see below.
I could not understand it!! I tried to enter A1=10, A2=20, A3=30
I got 4. So row 4 is empty. So far so good. But when I did A1=10, A2=(empty), A3=30
I got 3 but row 3 is not empty. Is the code below makes any sense to you? Thank you


'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1


https://www.excel-easy.com/vba/userform.html
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
If you have values in A1 & A3 countA will give 2 (ie 2 values in the column) you then add 1 which gives 3.

If you are looking for the last used row +1 try
Code:
range("A"&rows.Count).End(xlUp).Offset(1).row
 
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,721
Members
449,465
Latest member
TAKLAM

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