View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Susanne Susanne is offline
external usenet poster
 
Posts: 20
Default How do i create a popup window (a macro ?)

Hi again

I have the userform working but how do I get the range that I have selected
into a chart that I want my macro to make.
This is how it looks (part of my macro) right now with one particular sheet
selected. I now want the popup window to let me select a sheet and then a
range and then draw a chart.

Sheets("TR6_BP3_BP5_122_125_20050408_00").Select
Range("N:N,S:S").Select
Range("S2").Activate
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData
Source:=Sheets("TR6_BP3_BP5_122_125_20050408_00"). _
Range("N1:N9261,S1:S9261"), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = _
"=TR6_BP3_BP5_122_125_20050408_00!R2C19:R9261C 19"
ActiveChart.SeriesCollection(1).Values = _
"=TR6_BP3_BP5_122_125_20050408_00!R2C14:R9261C 14"
ActiveChart.Location Whe=xlLocationAsNewSheet
ActiveChart.ChartTitle.Select
Selection.Characters.Text = "Capacity test 067L5640
and so on...

Susanne

"Patrick Molloy" skrev:

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