Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using Excel 2007, but have same problem in 2003. And to be clear, this is
about actual user fomrs, not controls on a worksheet. I see a lot of stuff on Google and in the groups about dealing with controls when they're inserted into worksheets, but this is about those user forms you design in the VBA editor. I am trying to add a completely new aspect of pricing to a kind of hurky-jerky-typical-started-out-small-then-kept-getting-added to excel application hat I've been dropped in the middle of: Looping through the list of controlnames listed in a worksheet (this is going on behind the scenes while the form's showing and being interacted with), If the left 6 characters of the control's name are "BrkQua", then it is a textbox, and I need to take the value that is in that textbox (the one on the form) and do a Vlookup function that performs price breaks based on quantity (I got the Vlookup part from the ozgrid site, I believe). So, for every control whose name starts with "BrkQua", I look up that control's value in a specific range in a spreadsheet, and multiply that value by what my Vlookup gets. My problem so far is referring to the value of these controls. It seems that when I have a control's name in a variable, I can't refer to it's value. If my variable is ControlName, then this works: If Left(ControlName,6) = "BrkQua" then MsgBox ControlName, vbOKOnly,"" End If This will give me a popup with the actual whole name of the control. However, when I try If Left(ControlName,6) = "BrkQua" then MsgBox ControlName.value, vbOKOnly, "" Gives me a syntax error, or I get other errors when I try Controls(ControlName).value or other variations I've tried using parenthesis and quotes and things. I can't seem to find a way to have a control's name be in a variable, and while in my loop access the value of that control. Can someone help me with this? Your assistance would be greatly appreciated, and thanks for reading. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
2007 Form Control/ActiveX Control font difference | Excel Discussion (Misc queries) | |||
Using a Form to control variable fields. | Excel Programming | |||
variable form control | Excel Programming | |||
Variable Reference to a Form Control | Excel Programming | |||
Tool Tip Text for Form control/ Active-X control | Excel Programming |