Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect last row of Selection?
I want to have the following loop:
for each cell in Selection if 'cell in last row in Selection' and 'condition based on cell.value' then ' process cell in last row else ' process other cells normally end if next How do I implement the test "cell in last row in Selection"? Note: Selection is an n-by-m area. So simply testing "something = last cell of Selection" will not suffice. I need to recognize any cell in the last row. Besides, I don't even know how to implement "something = last cell of Selection". I don't know how to write "something" (some property of cell?); and I don't know how to write "last cell of Selection". (Klunk!). For my edification, I would appreciate it if someone would tell me how to implement "something = last cell in Selection", even though that does not address my original problem above. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect last row of Selection?
lr = rows(selection.row+selection.rows.count-1).row
for each cell in Selection If cell.row = lr then ' process cell in last row else ' process other cells normally end if next -- HTH Bob Phillips (remove nothere from email address if mailing direct) " wrote in message ... I want to have the following loop: for each cell in Selection if 'cell in last row in Selection' and 'condition based on cell.value' then ' process cell in last row else ' process other cells normally end if next How do I implement the test "cell in last row in Selection"? Note: Selection is an n-by-m area. So simply testing "something = last cell of Selection" will not suffice. I need to recognize any cell in the last row. Besides, I don't even know how to implement "something = last cell of Selection". I don't know how to write "something" (some property of cell?); and I don't know how to write "last cell of Selection". (Klunk!). For my edification, I would appreciate it if someone would tell me how to implement "something = last cell in Selection", even though that does not address my original problem above. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to detect last row of Selection?
Bob Phillips wrote:
lr = rows(selection.row+selection.rows.count-1).row for each cell in Selection If cell.row = lr then ' process cell in last row Perfect! Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Limiting selection in a cell AND linking that selection to a list | Excel Discussion (Misc queries) | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
To detect changes in a worksheet | Excel Programming | |||
Object Type of a selection... counting rows in a selection | Excel Programming | |||
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. | Excel Programming |