Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding the next empty cell.

Hi all,

A successful night so far as my first question was answered withi
seconds!

I want to populate the next available empty cell in a column with th
results of a VB script that returns a string.

Can anyone tell me how to locate the next empty cell?

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding the next empty cell.

lrow = ActiveSheet.UsedRange.Row + _
ActiveSheet.UsedRange.Rows.Count

Will give the first empty row. Replace the word "Row" with "Column
and get the first empty column. Is that good? - Piku

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding the next empty cell.

It will give the next row after the last row Excel considers to be used.
Considering a row to be used doesn't necessarily have anything to do with a
particular cell being empty or not although in many situations it will give
the desired result - quite unreliable for sheets with columns of varying
lengths and so forth.

--
Regards,
Tom Ogilvy



"pikus " wrote in message
...
lrow = ActiveSheet.UsedRange.Row + _
ActiveSheet.UsedRange.Rows.Count

Will give the first empty row. Replace the word "Row" with "Column"
and get the first empty column. Is that good? - Pikus


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding the next empty cell.

Any suggestions? - Piku

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding the next empty cell.

Thanks.

Sorry to be so dumb. Will this return a column/row value?

Ideally I want to identify the next cell in, lets say, column A, an
use that value to identify the cell to populate;

Worksheets("Sheet1").Range([next avalable cell]).Value = string

Hopefully I am making sense....

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding the next empty cell.

Assume column A
Cells(1,1).End(xldown)(2).Value = "String"

If A1 and or A2 could be blank

Dim rng as Range
if isempty(Range("A1")) then
set rng = Range("A1")
elseif isempty(Range("A2")) then
set rng = Range("A2")
else
set rng = Range("A1").End(xldown)
End if
set rng = rng(2)

if there will never be data below the "next empty cell"

set rng =cells(rows.count,1).End(xlup)
if not isempty(rng) then _
set rng = rng(2)



--
Regards,
Tom Ogilvy

"Unknown_User " wrote in
message ...
Hi all,

A successful night so far as my first question was answered within
seconds!

I want to populate the next available empty cell in a column with the
results of a VB script that returns a string.

Can anyone tell me how to locate the next empty cell?

Thanks!


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Finding the next empty cell.

If A1 and or A2 could be blank

Hi Tom is this a good option ?

Sub test()
On Error GoTo BodemUp
Columns("A").Cells.SpecialCells(xlCellTypeBlanks). Cells(1).Select
Exit Sub
BodemUp: Cells(Rows.Count, "A").End(xlUp)(2).Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Tom Ogilvy" wrote in message ...
Assume column A
Cells(1,1).End(xldown)(2).Value = "String"

If A1 and or A2 could be blank

Dim rng as Range
if isempty(Range("A1")) then
set rng = Range("A1")
elseif isempty(Range("A2")) then
set rng = Range("A2")
else
set rng = Range("A1").End(xldown)
End if
set rng = rng(2)

if there will never be data below the "next empty cell"

set rng =cells(rows.count,1).End(xlup)
if not isempty(rng) then _
set rng = rng(2)



--
Regards,
Tom Ogilvy

"Unknown_User " wrote in
message ...
Hi all,

A successful night so far as my first question was answered within
seconds!

I want to populate the next available empty cell in a column with the
results of a VB script that returns a string.

Can anyone tell me how to locate the next empty cell?

Thanks!


---
Message posted from http://www.ExcelForum.com/





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Finding the next empty cell.


Try:

ActiveSheet.UsedRange.Rows.Count + 1

On Tue, 18 May 2004 16:05:00 -0500, wrote:

Hi all,

A successful night so far as my first question was answered within
seconds!

I want to populate the next available empty cell in a column with the
results of a VB script that returns a string.

Can anyone tell me how to locate the next empty cell?

Thanks!


---
Message posted from http://www.ExcelForum.com/


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding the next empty cell.

Looks good to me Ron.

--
Regards,
Tom Ogilvy

"Ron de Bruin" wrote in message
...
If A1 and or A2 could be blank


Hi Tom is this a good option ?

Sub test()
On Error GoTo BodemUp
Columns("A").Cells.SpecialCells(xlCellTypeBlanks). Cells(1).Select
Exit Sub
BodemUp: Cells(Rows.Count, "A").End(xlUp)(2).Select
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Tom Ogilvy" wrote in message

...
Assume column A
Cells(1,1).End(xldown)(2).Value = "String"

If A1 and or A2 could be blank

Dim rng as Range
if isempty(Range("A1")) then
set rng = Range("A1")
elseif isempty(Range("A2")) then
set rng = Range("A2")
else
set rng = Range("A1").End(xldown)
End if
set rng = rng(2)

if there will never be data below the "next empty cell"

set rng =cells(rows.count,1).End(xlup)
if not isempty(rng) then _
set rng = rng(2)



--
Regards,
Tom Ogilvy

"Unknown_User " wrote in
message ...
Hi all,

A successful night so far as my first question was answered within
seconds!

I want to populate the next available empty cell in a column with the
results of a VB script that returns a string.

Can anyone tell me how to locate the next empty cell?

Thanks!


---
Message posted from http://www.ExcelForum.com/







  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding the next empty cell.

I posted several, not sure why they seem to be ignored.

--
Regards,
Tom Ogilvy

"pikus " wrote in message
...
Any suggestions? - Pikus


---
Message posted from http://www.ExcelForum.com/





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Finding the next empty cell.


Sorry ... this one was an accident. See Tom's post above.

On Tue, 18 May 2004 17:58:57 -0400, TJ Walls wrote:


Try:

ActiveSheet.UsedRange.Rows.Count + 1

On Tue, 18 May 2004 16:05:00 -0500, wrote:

Hi all,

A successful night so far as my first question was answered within
seconds!

I want to populate the next available empty cell in a column with the
results of a VB script that returns a string.

Can anyone tell me how to locate the next empty cell?

Thanks!


---
Message posted from http://www.ExcelForum.com/


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
Finding First Empty Cell in a Column TomHull Excel Discussion (Misc queries) 5 November 9th 09 01:19 AM
Finding First Empty Cell in a Column TomHull Excel Discussion (Misc queries) 0 November 9th 09 12:21 AM
Finding first (end of range) empty cell Alesandro Senerchia Excel Programming 4 May 20th 04 02:36 AM
Dynamically finding the last empty row Mike Potocki Excel Programming 3 October 17th 03 04:34 PM
Finding Empty Rows Tom Ogilvy Excel Programming 0 July 16th 03 04:54 PM


All times are GMT +1. The time now is 04:08 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"