ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine Last Cell (https://www.excelbanter.com/excel-programming/328310-determine-last-cell.html)

J_Garcia

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.

Ron de Bruin

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.




Bob Phillips[_6_]

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.




K Dales[_2_]

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.


J_Garcia

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.






All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com