Hi
I am having an issue with returning the the row value / position within a range. For example, I have returned the row value for the worksheet:
But am failing miserably with getting the value from a range. The range is assigned as below:Dim ActiveRowCount As Integer ActiveRowCount = ActiveCell.Row 'In this example we will say it returns 18
I then try to return the row value of the active cell within the range (myRange), using the below:Set myRange = ActiveCell.CurrentRegion RowCount = myRange.Rows.Count ' In this example we say it returns 15
The above returns 18, which is the return value for the active cell in the worksheet and not within the range. In the above example the return value for the range should have been 7.myRangeActiveRowCount = myRange.Application.ActiveCell.Row
Any help would be much appreciated.
Last edited by NBVC; 06-01-2011 at 10:50 AM.
Please use code tags for code snippets... I added them this time for you....
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
The row position of the active cell relative to myrange is
myRow = ActiveCell.Row - myRange.Row + 1
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks