to know end cell through macro


Posted by Sandip on November 26, 2001 2:42 PM

Hi,
I have to solve two problems.
1. How to get the last row number having data from another workbook?
2. how to write excell macro to copy a cell range in the current worksheet till the row # found in the previous query.

thanks in advance.
sandip

Posted by jacob on November 26, 2001 3:15 PM



Posted by jacob on November 26, 2001 3:23 PM

This Should Help

This Should Help:
To find the last row use this
FinalRow = Range("A65536").End(xlUp).Row
that will give you the row value
To get the data from another workbook the macro could open the workbook, or you could have data in this workbook that tracks the other data. For example lets say the data stats at A1, then somewhere on this workbook at row 1 have something like =(theothereworkbook,location,name,etc) Excel will automatically put in the right format if you just type = and select a1 in the other workbook.

For the second part just use something like
sub copyit()
FinalRow = Range("A65536").End(xlUp).Row
range(range where data to be copied is).select
selection.copy
for x=1 to finalrow
range("A"&x).select
activesheet.paste
next x
end sub
Hope this helps

Jacob