![]() |
dtermine row/column boundaries of selected area
|
dtermine row/column boundaries of selected area
Try
Sub Sonic() FRow = Selection(1).Row FCol = Selection(1).Column LRow = FRow + Selection.Rows.Count - 1 LColumn = FCol + Selection.Columns.Count - 1 LRow = Selection(Selection.Cells.Count).Row LColumn = Selection(Selection.Cells.Count).Column MsgBox LColumn MsgBox LRow MsgBox FCol MsgBox FRow End Sub Mike "John Keith" wrote: After a user has selected an area on a worksheet I need to have a macro determine the top and bottom row boundaries and the left and right column boundaries of the range. How is this accomplished in a macro? Thanks John Keith |
dtermine row/column boundaries of selected area
|
dtermine row/column boundaries of selected area
On Tue, 2 Jun 2009 09:30:01 -0700, Mike H
wrote: Try Sub Sonic() FRow = Selection(1).Row FCol = Selection(1).Column LRow = FRow + Selection.Rows.Count - 1 LColumn = FCol + Selection.Columns.Count - 1 That looks cool too! I learn so much in this group, I wish I had time to read every thread! John Keith |
dtermine row/column boundaries of selected area
On Tue, 2 Jun 2009 09:09:07 -0700, Gary''s Student
wrote: This works well if the Selection is a nice block: ' the worksheet of the range ' the workbook of the range ' count of cells The comments at the start of the sample code suggested the worksheet, workbook and cell count can be found but were not inlcuded in the code. What is the correct structure to get that info? John Keith |
All times are GMT +1. The time now is 10:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com