Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need code (Excel)

    Hi,
    I'm really confuse which macro to use. what i need to do is...to do a chart, first users select a list of months from the listbox, and then the need to specify which sort of data they need, differences or daily data from the combobox. when they click "finish" button, the graph will appear. I have done the code to do chart. what i dont know is, how to do code to link between combobox and listbox. and also, how to link all those things to the chart code?

  2. #2
    New Lounger
    Join Date
    Feb 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: need code (Excel)

    Here is the attachment for the problem...hope this may makes thing clearer

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: need code (Excel)

    Your code for the command button1 can look at "listbox1.value" to determine the month and it can look at the "optionbutton1.value" and optionbutton2.value to look for if it is pressed (true/false)

    I am not sure from your file what you want to do with that info so I can't give too much more detail.

    If you add this code to the worksheet object in VB, when you press the button it will indicate what you have chosen. I hope this helps

    Steve
    <pre>Private Sub CommandButton1_Click()
    Dim sMsg As String
    If OptionButton1.Value Then sMsg = "Daily Sales"
    If OptionButton2.Value Then sMsg = "Sales Difference"
    sMsg = "You chose:" & vbCrLf & ListBox1.Value _
    & vbCrLf & sMsg
    MsgBox sMsg
    End Sub</pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •