ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get user selected range into RefEdit (https://www.excelbanter.com/excel-programming/294704-get-user-selected-range-into-refedit.html)

J. Hall

Get user selected range into RefEdit
 
I've created a calendar on which a teacher will select a range of
class periods (vertical cells) for which he/she wants to reserve a
laptop computer cart. When they select my custom menu item a form will
pop up with list boxes to indicate the teacher's name, room number,
and building, as well as a refedit control.

I would like to have the RefEdit control field show the range that the
teacher has already selected. (The teacher may then accept the range
that was pre-selected, or may change his/her mind to select another
range.)

The spreadsheet is called "Laptop Schedule.xls". There are 13 sheets
(one for each month and one for lists of teachers' names, room numbers
and building names for the above form.

I know only enough VBA to be quite dangerous, so please go easy!
Thanks...

Vasant Nanavati

Get user selected range into RefEdit
 
Perhaps something like:

Private Sub UserForm_Activate()
If TypeName(Selection) = "Range" Then RefEdit1 = Selection.Address
End Sub

--

Vasant


"J. Hall" wrote in message
om...
I've created a calendar on which a teacher will select a range of
class periods (vertical cells) for which he/she wants to reserve a
laptop computer cart. When they select my custom menu item a form will
pop up with list boxes to indicate the teacher's name, room number,
and building, as well as a refedit control.

I would like to have the RefEdit control field show the range that the
teacher has already selected. (The teacher may then accept the range
that was pre-selected, or may change his/her mind to select another
range.)

The spreadsheet is called "Laptop Schedule.xls". There are 13 sheets
(one for each month and one for lists of teachers' names, room numbers
and building names for the above form.

I know only enough VBA to be quite dangerous, so please go easy!
Thanks...




Steve Garman

Get user selected range into RefEdit
 
Assuming a RefEdit called "RefEdit1", in the code for the userform, try:

Private Sub UserForm_Activate()
RefEdit1.Text = Selection.Address
End Sub



J. Hall wrote:
I've created a calendar on which a teacher will select a range of
class periods (vertical cells) for which he/she wants to reserve a
laptop computer cart. When they select my custom menu item a form will
pop up with list boxes to indicate the teacher's name, room number,
and building, as well as a refedit control.

I would like to have the RefEdit control field show the range that the
teacher has already selected. (The teacher may then accept the range
that was pre-selected, or may change his/her mind to select another
range.)

The spreadsheet is called "Laptop Schedule.xls". There are 13 sheets
(one for each month and one for lists of teachers' names, room numbers
and building names for the above form.

I know only enough VBA to be quite dangerous, so please go easy!
Thanks...




All times are GMT +1. The time now is 01:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com