View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default How do i create a popup window (a macro ?)

you could use a userform onto which you drop a refedit box and a combobox
populate the combo with the sheets...here's an quick example
Add a userform ( called userform1)
onto userform1 add a combobox ( called combobox1) and below it, a refedit
control
Add this code to the form's code page:

Option Explicit
Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In Worksheets
ComboBox1.AddItem ws.Name
Next
End Sub
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then Exit Sub
Worksheets(ComboBox1.Value).Activate
End Sub

First, when you run the form, the combobox gets populated with all th
eworksheet names.

Selecting a sheetname in the combobox, fires the combobox's chnage event,
ant that sheet gets activated
Clicking the refedit control allows you to select a range on whatever is the
active sheet.





"Susanne" wrote:

Hi

I would like to create a popup window in VBA in Excel that will let me
choose any excel sheet and then I need another popup window that will let me
choose a range from the sheet I haven chosen so i can ceate a chart.
Thanks for any help.

Susanne