Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determine Last Cell

I am writing a script in vbscript where I am querying multiple machines and
moving that data into an excel spreadsheet. So the idea is that computer1
info is display in A1, B1, C1, etc. and computer2 is displayed in
A2,B2,C3,etc. Computer1 might need to display data in A1,A2, A3, B1, C1 so
when computer2 starts to display data it will start at A4 but then proceed at
B2, C3, etc. What I want is for computer2 to display data at A4 for example
and continue at B4, C4, etc. So I am trying to figure out how to determine
the last cell used so that I may start the next display in a new row. I hope
this makes sense, any help is much appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Determine Last Cell

Hi J_Garcia

You can use a function like this

Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

See this page for examples how to use it
http://www.rondebruin.nl/copy1.htm


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



"J_Garcia" wrote in message ...
I am writing a script in vbscript where I am querying multiple machines and
moving that data into an excel spreadsheet. So the idea is that computer1
info is display in A1, B1, C1, etc. and computer2 is displayed in
A2,B2,C3,etc. Computer1 might need to display data in A1,A2, A3, B1, C1 so
when computer2 starts to display data it will start at A4 but then proceed at
B2, C3, etc. What I want is for computer2 to display data at A4 for example
and continue at B4, C4, etc. So I am trying to figure out how to determine
the last cell used so that I may start the next display in a new row. I hope
this makes sense, any help is much appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Determine Last Cell

This will get you the last row

Set rng = ActiveSheet.UsedRange
iLastRow = rng(rng.Count).Row


--

HTH

RP
(remove nothere from the email address if mailing direct)


"J_Garcia" wrote in message
...
I am writing a script in vbscript where I am querying multiple machines

and
moving that data into an excel spreadsheet. So the idea is that computer1
info is display in A1, B1, C1, etc. and computer2 is displayed in
A2,B2,C3,etc. Computer1 might need to display data in A1,A2, A3, B1, C1

so
when computer2 starts to display data it will start at A4 but then proceed

at
B2, C3, etc. What I want is for computer2 to display data at A4 for

example
and continue at B4, C4, etc. So I am trying to figure out how to

determine
the last cell used so that I may start the next display in a new row. I

hope
this makes sense, any help is much appreciated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Determine Last Cell

Range("A1").CurrentRegion.Rows.Count gives the number of used rows between A1
and the next blank row

"J_Garcia" wrote:

I am writing a script in vbscript where I am querying multiple machines and
moving that data into an excel spreadsheet. So the idea is that computer1
info is display in A1, B1, C1, etc. and computer2 is displayed in
A2,B2,C3,etc. Computer1 might need to display data in A1,A2, A3, B1, C1 so
when computer2 starts to display data it will start at A4 but then proceed at
B2, C3, etc. What I want is for computer2 to display data at A4 for example
and continue at B4, C4, etc. So I am trying to figure out how to determine
the last cell used so that I may start the next display in a new row. I hope
this makes sense, any help is much appreciated.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Determine Last Cell

I am sorry but I am very new to this. How would I use this? Could I fill in
that last row with text to indicate the task completed?

"Bob Phillips" wrote:

This will get you the last row

Set rng = ActiveSheet.UsedRange
iLastRow = rng(rng.Count).Row


--

HTH

RP
(remove nothere from the email address if mailing direct)


"J_Garcia" wrote in message
...
I am writing a script in vbscript where I am querying multiple machines

and
moving that data into an excel spreadsheet. So the idea is that computer1
info is display in A1, B1, C1, etc. and computer2 is displayed in
A2,B2,C3,etc. Computer1 might need to display data in A1,A2, A3, B1, C1

so
when computer2 starts to display data it will start at A4 but then proceed

at
B2, C3, etc. What I want is for computer2 to display data at A4 for

example
and continue at B4, C4, etc. So I am trying to figure out how to

determine
the last cell used so that I may start the next display in a new row. I

hope
this makes sense, any help is much appreciated.




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
Determine Value of Cell? [email protected] Excel Worksheet Functions 6 January 29th 08 07:34 PM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Excel Worksheet Functions 1 June 23rd 05 07:53 PM
Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell? vlado_varna Excel Programming 5 April 13th 05 11:36 PM
Function to determine if any cell in a range is contained in a given cell [email protected] Excel Worksheet Functions 3 February 7th 05 04:19 PM
I need to determine a cell range based on a blank cell Katrina Excel Programming 1 July 3rd 03 09:11 PM


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