![]() |
Capture the range a user selects and put in textbox.
Hi,
I am trying to capture the range a user selects then put that information into a textbox in a userform. That's the start cell and end cell addresses, not the contents. I have a Userform with an Excel workbook. The user is going to highlight a range of cells in any worksheet in any workbook () and I want the following details to be shown in text-boxes in my Userform. The data I need is: Workbook Name Worksheet Name First Cell of the range selected Last Cell of the range selected. Does anyone have any ideas? I thought there would be some way of converting a Range to a String, but I didn't very far down that route. Thanks in advance! Drew. |
Capture the range a user selects and put in textbox.
Hi
sub test() dim start as string, finish as string With Selection start = .Cells(1,1).address is the first cell finish = .Cells(.rows.count, .columns.count).address End With msgbox start msgbox finish end sub regards Paul |
Capture the range a user selects and put in textbox.
tbWB.Value = Selection.parent.Parent.Name
tbWS.Value = Selection.Parent.Name tbFirstCell.Value = Selection(1).Address tbLastCell.Value = Selection(Selection.Count).Address HTH -- AP "Drew" a écrit dans le message de ups.com... Hi, I am trying to capture the range a user selects then put that information into a textbox in a userform. That's the start cell and end cell addresses, not the contents. I have a Userform with an Excel workbook. The user is going to highlight a range of cells in any worksheet in any workbook () and I want the following details to be shown in text-boxes in my Userform. The data I need is: Workbook Name Worksheet Name First Cell of the range selected Last Cell of the range selected. Does anyone have any ideas? I thought there wtould be some way of converting a Range to a String, but I didn't very far down that route. Thanks in advance! Drew. |
All times are GMT +1. The time now is 07:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com