Help! Finding empty cell..........

MGhell

Board Regular
Joined
Jan 16, 2006
Messages
85
Hi,

I have the following line which should give me the last blank cell in a given column. Unfortunately it seems that the code counts cells which contain formulas as non-empty cells. Is there a way to avoid this?

lastrow = Cells(Rows.Count, "K").End(xlUp).Row


Greetings

Max
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
mmm, I would think at that point you do a for next loop:

Code:
for cnt = Cells(Rows.Count, "K").End(xlUp).Row  to 1 step -1

  if Cells(cnt, "K").value <> "" then

    lastrow = cnt +1
    
    exit for

  end if

next cnt
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi,

you don't need the loop
Code:
lastrow = Columns("K").Find("*", [K1], xlValues, xlPart, xlByRows, xlPrevious, False, False).Row
kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,129,592
Messages
5,637,290
Members
416,962
Latest member
samfuge

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
Top