Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Find last nonblank cell in column

I have a small problem and don't know how to solve it...
Let's say I have range A1:A20 filled with some values and want to add a new
value in A21 but A19:A20 is hidden.
I tried range("A1:).end(xlDown).offset(1,0)="hallo", but the result of this
is that I fill range("A19") with "hallo" instead of range("A21")

How can I solve this little problem without unhiding those rows???

Thanks in advance,

Paul Bleijlevens


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Find last nonblank cell in column

Paul,

Try this

Range("A" & LastRow(Range("A1:A20")) + 1) = "hallo"

Function LastRow(rng As Range)
On Error Resume Next
LastRow = 1
With rng
LastRow = .Find("*", .Cells(1), xlFormulas, _
xlWhole, xlByRows, xlPrevious).Row
End With
End Function


--
HTH

Bob Phillips

"Pink Panther" wrote in message
l...
I have a small problem and don't know how to solve it...
Let's say I have range A1:A20 filled with some values and want to add a

new
value in A21 but A19:A20 is hidden.
I tried range("A1:).end(xlDown).offset(1,0)="hallo", but the result of

this
is that I fill range("A19") with "hallo" instead of range("A21")

How can I solve this little problem without unhiding those rows???

Thanks in advance,

Paul Bleijlevens




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find last nonblank cell in column


Pink, this will solve it:

Sub n()
Cells(Application.CountA(Range("a:a")) + 1, "a") = "halo"
End Sub


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=388637

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Find last nonblank cell in column


"davidm" wrote in
message ...

Pink, this will solve it:

Sub n()
Cells(Application.CountA(Range("a:a")) + 1, "a") = "halo"
End Sub


Not if the range includes some blank entries.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Find last nonblank cell in column

Thanks, this would do the job....


"Bob Phillips" wrote in message
...

"davidm" wrote in
message ...

Pink, this will solve it:

Sub n()
Cells(Application.CountA(Range("a:a")) + 1, "a") = "halo"
End Sub


Not if the range includes some blank entries.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CELL EQUALS LAST NONBLANK CELL IN A COLUMN Vicky Excel Worksheet Functions 5 February 29th 08 06:18 PM
Find Nonblank Cell Mike Excel Worksheet Functions 4 August 21st 07 03:55 PM
Find first nonblank cell row # in pivot table using MATCH Space Elf Excel Worksheet Functions 2 February 14th 06 09:50 PM
Require a cell to be nonblank if another cell is nonblank Herb Wexler Excel Discussion (Misc queries) 1 February 1st 06 08:05 PM
Find last nonblank in a column George W. Barrowcliff Excel Worksheet Functions 12 July 26th 05 05:40 PM


All times are GMT +1. The time now is 04:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"