Results 1 to 2 of 2

Thread: Combo Boxes in Excel

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    1

    Exclamation Combo Boxes in Excel

    Hello, I need some help writing the appropriate code to move and stop my combo box in Excel. The code below shows my recorded macro that moves my combo box a certain increment; however, if you hit the macro button on the Excel screen it continues to move the box by that increment. What I want is to be able to have it move only once, and then stop, or have the code to create a origin for my combo box pulldown. Any suggestions?

    Sub NewMacro1()
    '
    ' NewMacro1 Macro
    ' Macro recorded 8/15/2005 by e0062010
    '

    '
    Application.Run "Proto1.xls!Default2"
    ActiveSheet.Shapes("Drop Down 133").Select
    Selection.ShapeRange.IncrementLeft -90#
    Range("A16").Select
    End Sub


    Sub NewMacro2()
    '
    ' NewMacro2 Macro
    ' Macro recorded 8/15/2005 by e0062010
    '

    '
    Application.Run "Proto1.xls!Custom"
    ActiveSheet.Shapes("Drop Down 133").Select
    Selection.ShapeRange.IncrementLeft 90#
    Range("A9").Select
    End Sub
    Last edited by Aron40; Aug 17th, 2005 at 09:32 AM.

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    Re: Combo Boxes in Excel

    Hi. Welcome to VBF.
    I'm not too sure what you are trying to achieve. Could you explain why you want to move your combo around? Or is that not relevant?
    This code will do something like what you ask (if I understand correctly), but it's not the finished article by any means...
    VB Code:
    1. Option Explicit
    2.  
    3. Private bMovedAlready As Boolean
    4.  
    5.  
    6. Sub NewMacro1()
    7.     '
    8.     ' NewMacro1 Macro
    9.     ' Macro recorded 8/15/2005 by e0062010
    10.     '
    11.    
    12.     '
    13.     If bMovedAlready = False Then
    14.         Application.Run "Proto1.xls!Default2"
    15.         ActiveSheet.Shapes("Drop Down 133").Select
    16.         Selection.ShapeRange.IncrementLeft -90#
    17.         Range("A16").Select
    18.         bMovedAlready = True
    19.     End If
    20.  
    21. End Sub
    22.  
    23.  
    24. Sub NewMacro2()
    25.     '
    26.     ' NewMacro2 Macro
    27.     ' Macro recorded 8/15/2005 by e0062010
    28.     '
    29.    
    30.     '
    31.     If bMovedAlready = True Then
    32.         Application.Run "Proto1.xls!Custom"
    33.         ActiveSheet.Shapes("Drop Down 133").Select
    34.         Selection.ShapeRange.IncrementLeft 90#
    35.         Range("A9").Select
    36.         bMovedAlready = False
    37.     End If
    38.  
    39. End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width