|
-
Aug 17th, 2005, 09:27 AM
#1
Thread Starter
New Member
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.
-
Aug 17th, 2005, 03:44 PM
#2
Frenzied Member
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:
Option Explicit
Private bMovedAlready As Boolean
Sub NewMacro1()
'
' NewMacro1 Macro
' Macro recorded 8/15/2005 by e0062010
'
'
If bMovedAlready = False Then
Application.Run "Proto1.xls!Default2"
ActiveSheet.Shapes("Drop Down 133").Select
Selection.ShapeRange.IncrementLeft -90#
Range("A16").Select
bMovedAlready = True
End If
End Sub
Sub NewMacro2()
'
' NewMacro2 Macro
' Macro recorded 8/15/2005 by e0062010
'
'
If bMovedAlready = True Then
Application.Run "Proto1.xls!Custom"
ActiveSheet.Shapes("Drop Down 133").Select
Selection.ShapeRange.IncrementLeft 90#
Range("A9").Select
bMovedAlready = False
End If
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|