VB help with Autorun of spreadsheet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bg0420
    New Member
    • Aug 2007
    • 4

    VB help with Autorun of spreadsheet

    Ok guys and gals! I have some VB code that I'm about to post, hope I don't get into trouble for posting this by my boss but I need major help! So here goes. I need this To work every time I open the spreadsheet. Here is the code can someone help in finding a way for it to automatically run?

    [CODE=vb]Private Sub ComboBox1_open( )
    ComboBox1.Clear
    ComboBox1.AddIt em ...
    ComboBox1.AddIt em ...
    ...
    End Sub

    Private Sub ComboBox1_Chang e()
    Select Case ComboBox1.Value

    Case ...
    Cells(5, 4).Value = "..."
    Cells(5, 5).Value = "..."
    ...
    End Select

    End Sub[/CODE]

    Please I need this done by the end of the week. Thank you in advanced!
    Last edited by Killer42; Aug 9 '07, 03:05 AM. Reason: Added [CODE=vb] tag, shortened code to avoid trouble with your boss :)
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    You could try putting it (or better, putting a call to it) in the Workbook_Open event.

    Comment

    • bg0420
      New Member
      • Aug 2007
      • 4

      #3
      Originally posted by Killer42
      You could try putting it (or better, putting a call to it) in the Workbook_Open event.


      Just done it and all it did was put a date in with no working combo box.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by bg0420
        Just done it and all it did was put a date in with no working combo box.
        You just asked how to get it ro run automatically. Are you saying there are further problems with the code?

        Comment

        • bg0420
          New Member
          • Aug 2007
          • 4

          #5
          Originally posted by Killer42
          You just asked how to get it ro run automatically. Are you saying there are further problems with the code?

          I'm guessing so. I have posted the code into the VB under Sheet1 and I have to manually go into the VB by pressing F11 then I have to put my cursor next to the end sub and press F5. I'm not understanding of why I have to do that every time I open the spreadsheet up.

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Well, I don't know, but whatever you put in the Workbook_Open event should run automatically when the workbook is opened.

            Comment

            • bg0420
              New Member
              • Aug 2007
              • 4

              #7
              Originally posted by Killer42
              Well, I don't know, but whatever you put in the Workbook_Open event should run automatically when the workbook is opened.

              I just hit another problem, I added another Combobox and put a bunch of code into it and it said it's to big. I guess I'm screwed.

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by bg0420
                I just hit another problem, I added another Combobox and put a bunch of code into it and it said it's to big. I guess I'm screwed.
                What said that what is too big?

                Comment

                Working...