randolphoralph
Board Regular
- Joined
- Dec 24, 2008
- Messages
- 126
I have created a Userform with 3 items...
#1 List Box which contains a list of Workbooks. Here is the code:
#2 RefEdit that allows me to select a range.
#3 Command Button. Here is the code
The issue I have is the List Box allows me to change between workbooks, but the RefEdit does not capture the workbook name.
So for example if I am in Book1.xls and select Book2.xls in the ListBox and select the range Sheet1!A1:B5 the RefEdit only shows Sheet1!A1:B5.
How would I get RefEdit to return [Book2.xlsx]Sheet1!A1:B5?
#1 List Box which contains a list of Workbooks. Here is the code:
Code:
Private Sub ListBox1_Click()
Windows(ListBox1.Value).Activate
End Sub
Private Sub UserForm_Activate()
Dim wkb As Workbook
For Each wkb In Workbooks
If Windows(wkb.Name).Visible Then _
ListBox1.AddItem wkb.Name
Next
End Sub
#2 RefEdit that allows me to select a range.
#3 Command Button. Here is the code
Code:
Private Sub CommandButton1_Click()
ActiveCell = RefEdit1.Value
Unload.Me
End Sub
The issue I have is the List Box allows me to change between workbooks, but the RefEdit does not capture the workbook name.
So for example if I am in Book1.xls and select Book2.xls in the ListBox and select the range Sheet1!A1:B5 the RefEdit only shows Sheet1!A1:B5.
How would I get RefEdit to return [Book2.xlsx]Sheet1!A1:B5?