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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,179
Messages
5,857,797
Members
431,898
Latest member
JockeyDot

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