Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row Count from xlDown??

Status
Not open for further replies.

Westicle

Programmer
Aug 22, 2002
29
0
0
GB
Is it possible to return the number of rows the following code would select. The selection is then to be pasted into another sheet and i need the number of rows so that i can paste a formula, say in row B1 for the same amount of rows.

Range("A1").Select
Selection.Copy
Range(Selection, Selection.End(xlDown))


cheers.
 
I tried the piece of code you supplied and had some problems, however, to get the number of rows in any selection try using something like:

Dim RowCount as Integer
RowCount = Selection.Rows.Count


FYI: Here is what I did to get test code to work

Code:
Dim RowCount As Integer

Range("A1").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
RowCount = Selection.Rows.Count
Debug.Print RowCount
ActiveSheet.Paste

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top