Access Worksheet Controls Properties & Methods
Aug 12, 2006
I am trying to implement code that can handle a dynamic number of objects, specifically check boxes.
I know of eval( ) in perl that allows one to dynamically create command lines. For instance, the following code would change all of the Checkbox values to 1. The syntax may not be correct but the idea is solid.
Do While i < num_checkboxes
eval("Checkbox" .i. ".Value=1)
Loop
Does this funtion also exist in excel?
View 6 Replies
ADVERTISEMENT
Jan 30, 2009
I want to access the Properties of a number of controls in a running form, and these controls may or may not be contained in a Frame or a MultiPage.
In particular I want the Top and Left for these controls, which means I have to first find out if the control is contained in a Frame or MultiPage so I can get the reference for Top and Left. I'm ok with doing this for controls inside a Frame, but the MultiPage is eluding me. I get an error when I try to access these controls and it looks like they are actually owned by the individual Pages of the MultiPage.
how do I find out if a given control is contained in a given MultiPage?
Validate UserForm MultiPage and Frame Controls
View 3 Replies
View Related
Aug 16, 2007
I need to learn the syntax and all options I can use with the Selection function - where can I find that info? I can't find anything in in Visual Basic Help (I find microsoft help is generally totally useless).
For example, in the code below, what are all the options I can use after "Selection. " (ie .Copy, .End, .Select) and what do I use if I want to select a certain number of cells to the left or to the right or up or down?
Sub Fill()
Selection.Copy Destination:=Range(Selection, Selection.End(xlDown).Offset(-1))
Selection.End(xlDown).Select
End Sub
I'm just noticing now that the "(xlDown)" is X L, not X 1, which I thought might make sense to say "1 time Down". What does the "xl" stand for?
View 7 Replies
View Related
Feb 11, 2009
some of your favorite Methods/Properties exposed by the Range Object. How's bout some that you just can't live without?
Have an tricks for example that you can do with XLS03 that for example couldn't do with XLS2K or perhaps XLS07 that you couldn't do with XLS03?
View 9 Replies
View Related
Feb 26, 2008
I've created a custom ribbon which contains checkboxes that hide or show columns.
I would like to change the enable state of the checkboxes while the user is interacting with the spreadsheet.
For example:I would like to disable all of the checkboxes if they are not viewing sheet1I would like to disable the second checkbox if the first checkbox is unchecked.
I know how to set these all on initialize. I just have not figured out how to update these controls after it has been opened.
View 4 Replies
View Related
Nov 20, 2013
I have about a googol conditionally formatted cells in a workbook. Some of these cells are formatted to display, in particular circumstances, a rather unpleasant shade of orange.
I now need to change that colour (to an even more unpleasant chade of orange).
Can I loop through all cells, test whether any of the conditions apply the colour in question and if so, set it to something else?
View 2 Replies
View Related
Apr 10, 2013
I am developing a VBA for Excel application which uses transient worksheets to collect data from users before writing the data back to master spreadsheets.
My application opens an instance of excel with a workbook and worksheet using the following code:
Dim xlsInstance As Object
Dim wkb As Workbook
Dim wks As Worksheet
Set xlsInstance = CreateObject("Excel.Application")
Set wkb = xlsInstance.Workbooks.Add
wkb.Activate
Set wks = wbk.Worksheets.Add
wks.Activate
I can reference various ranges in the worksheet and do most of what I need but I need to override the Worksheet_Change method. Easily done for static sheets, but this must be set at runtime when the worksheet is created.
View 9 Replies
View Related
Apr 11, 2008
As a follow-up to Cannot Access Additional Controls From Toolbox.
I have been having the same problems adding additional controls to the toolbox in Excel VBA on Windows Vista running Office 2007 Pro.
I ensured I had a full install of Office and I was logged in with admin rights.
Two work-arounds:Create a form in Excel on a machine that has the control you need to use, then export the form. Copy it to the PC that doesn't have the additional controls functioning properlyOn my machine, creating a new profile and running VBA enabled the additional controls *only for this profile*, not the existing profile.
While these work-arounds don't solve the problem, they point to it being a profile issue, not an Office installation issue.
Hope this saves you the hours of Googling that I have spent trying to find a solution.
View 3 Replies
View Related
Feb 19, 2010
How to access the full set of attributes of a control when grouped?
I am trying to access the properties of a grouped set of checkboxes (for grouped I mean selected and right click - > Group)
It appears that grouped controls are not accessible through OLEObjects() but they can be accessed as shapes. For example, the following code will set all elements in the group Advertisement2 to .Visibility = False:
For Each T In ActiveSheet.Shapes("Advertisement2").GroupItems
T.Visible = True
Next
However, most other properties, such as .Enabled or .Value are not accessible (probably because the controls are considered shapes).
I have tried all sort of solutions, including using
.groupItems("ControlName").Value
or
.groupItems("ControlName").Object.Value
View 9 Replies
View Related
Mar 24, 2008
I get a userform with inDays1,inDays2,inDays3.. until inDays10 textboxs, I would like to acces them in a for statement. I've try this, but it doesn't work,
For iNumber = 1 To 10
frmReservation.inDays(iNumber).Caption = whatever.Value
..
..
Next iNumber
View 4 Replies
View Related
Sep 22, 2006
I have a workbook with 10 worksheets and I need to know the memory size for each worksheet. I know from File/ Properties that the file is 3.7mb but that is much higher than I would have expected. I can't tell which worksheets are causing it to be so large.
View 5 Replies
View Related
Oct 28, 2008
I have a button on a worksheet that activates a macro, the macro is stored in a "personal.xlsb" file. This file is copied to several users computers so they can use the macro, problem is once the button is assigned to a macro from one computer all the other users can't use the macro. What can I do to make this macro work on all computers? (Less placing yet another button on the tool bar).
View 2 Replies
View Related
Nov 2, 2007
I am trying to change the text that appears on a button on a worksheet via a macro. There is only one button on the worksheet so in the macro I use
MyCaption = activecell.value 'Pick up the button text from the spreadsheet
For each sh in activesheet.shapes
sh.caption = MyCaption
'I know this would do all, but only one button as I said
next sh
which generates "Object doesn't support this property or method".
This is strange because if you get the properties box up, Caption definitely shows as a property of a button control.
View 9 Replies
View Related
Sep 21, 2006
how to get a list of the properties for form control shapes (not control toolbox shapes) that are placed on a worksheet (not on a userform). Eg., a button, checkbox, combobox, etc.
If it's possible, I'm interested in working with properties like "enabled", "caption", etc. that aren't listed on the "Format Control Properties" dialog.
I understand you can edit properties of a form control shape via VBA code (See example below), however, I can't seem to find anything within the object browser about them.
EXAMPLE
With ActiveSheet.Shapes("Scroll Bar 2").ControlFormat
.Min = 10
.Max = 150
End With
View 5 Replies
View Related
May 10, 2009
I'm building a spreadsheet for a sporting franchise using a pull-down validation menu. Once the opposing team name is selected from the drop down menu, I would like it to display the opposing teams players and their statistics.
On the database worksheet, I have a web query pulling names and statistics from the web. Each player name has his team name in his corresponding row. What function can I use that will search for that team name and report it back to the display sheet? Once I have the player name there, I think I can figure the statistic portion... But I can't seem to figure out how to pull all of the players with the matching team name into my display sheet.
Example:
A1 on worksheet "A" contains a pull down menu with team names "Lightning", "Storm", "Magic", and "Thunder".
A16-A20 on worksheet "B" contains players from team "Lightning"
A21-A25 on worksheet "B" contains players from team "Storm"
A26-A30 on worksheet "B" contains players from team "Magic"
A31-A35 on worksheet "B" contains players from team "Thunder"
B16-B20 on worksheet "B" contains team name "Lightning"
B21-B25 on worksheet "B" contains team name "Storm"
B26-B30 on worksheet "B" contains team name "Magic"
B31-B35 on worksheet "B" contains team name "Thunder"
If I pull down "Lightning" on A1 (worksheet "A"), I want the following to display:..........................
View 4 Replies
View Related
Jul 2, 2007
I am trying to change the property value of all optionbuttons on userform1 via userform2's deactivate event
Private Sub UserForm2_Deactivate()
If userform1.Controls = OptionButton Then
Value = False
End If
End Sub
View 5 Replies
View Related
Oct 1, 2006
how would i be able to loop through all controls on a worksheet and see what type of control they are? : D
View 9 Replies
View Related
Oct 10, 2011
In my current project, I have set up a worksheet with 15 comboboxes (dropdown lists).
To trigger change events, I use :
Private Sub ComboBox1_Change()
....
End Sub
So, I have 15 such routines defined to cover all comboboxes. By doing so, my code becomes quite large
I am wondering if there is not a more efficient way to handle this.
View 1 Replies
View Related
Feb 16, 2009
I have problems wit setting some ActiveX controls properties. If I place ActiveX on worksheet manually, it is diferrent object, then If I place it by VBA code. I, am not able to open properities window for controls created by VBA. When I open properties window for ActiveX created manually, there is property fmbackstyle. If I am trying to set this property by VBA for controls created by VBA, result is error.
View 9 Replies
View Related
Jun 22, 2006
I'm looking for a way to loop through the ActiveX controls (option buttons) in one sheet so that I can have these option buttons reflect what I select on the front sheet.
View 2 Replies
View Related
Mar 31, 2008
I have an excel file that has quite a few buttons with macros attached and combo boxes. On one computer it runs perfectly normally, however on another, when the file opens all the comboxes and buttons with macros attached have been stripped from the file.
View 8 Replies
View Related
May 3, 2008
I would like to know if it's possibale to use VB, to auto manage these levels
IE, 1 box asks for the part number 2nd asks you how many 3rd/4th boxes are "+", "-"
When + or - is pressed the part number will automatically add's/subtracts that part level. I had 10x abcde's I enter 2 in "How Many", then press "-" it will then adjust the level from 10 to 8
View 5 Replies
View Related
Sep 27, 2006
I have a userform that stores data (1 row record with 20 columns) to a worksheet.Is there a way to grab the data back in (other or the same)userform, ambent(correct) data and store them back in the same row in the worksheet?
View 2 Replies
View Related
Oct 4, 2006
I have used Option Buttons and Combo Boxes on my worksheet. When I print my worksheet, the controls which contain values do not print properly. They only print a fraction of their actual size relative to the rest of the worksheet. The properties are set so that they are printable. What setting do I need to change for them to print properly.
View 2 Replies
View Related
Aug 20, 2007
When placing a control on a worksheet, the text in the label,option box etc controls is vertical and I can't find a way of changing the direction to left to right. It doesn't happen on all workbooks. I can put the control on a "normal" workbook and then copy it to the "abnormal" workbook but I would like to know why/how I can change the direction of the text.
Under Tools/Options/International the text direction states left to right
View 6 Replies
View Related
Apr 2, 2008
I created a macro to create command buttons on sheet 1 of my worksheet. The created buttons using oleobject and class type: forms.commandbutton1, creates an object with no properties on the sheet (i.e. if you right click on it excel thinks it's an object and not a control.) Is there a way to create it as a control?
View 4 Replies
View Related
Apr 29, 2009
I would like to have 4 calendar controls in a worksheet, but even with only two controls I am receiving a Compile Error - Ambiguous name detected: Worksheet_BeforeDoubleClick
View 7 Replies
View Related
Mar 5, 2008
I'm currently building an Excel database. This database has a few comboboxes and checkboxes that are tied to each other. If I select the combobox option of "Years", the "Quarters" combobox must be greyed out. In addition depending on which option is chosen, the relevant check boxes must be enabeled or disabled. I've written some code which runs fine, until I try and activate another macro button or if I add and rename a sheet(which is not linked to anything). What should I do? Here is a sample of my code. I have a feeling it's really obviouse but I cant see it..
Private Sub ComboBox2_Change()
If Sheets("InputSheet").ComboBox2 = "Years" Then
Sheets("InputSheet").ComboBox3.Value = ""
Sheets("InputSheet").ComboBox3.Enabled = False
Sheets("InputSheet").CheckBox6.Enabled = True
Sheets("InputSheet").CheckBox7.Enabled = True
Sheets("InputSheet").CheckBox8.Enabled = True
Sheets("InputSheet").CheckBox9.Enabled = True
Sheets("InputSheet").CheckBox10.Enabled = True
Sheets("InputSheet").CheckBox11.Enabled = True
Sheets("InputSheet").CheckBox12.Enabled = True
Sheets("InputSheet").CheckBox13.Enabled = True
Sheets("InputSheet").CheckBox14.Enabled = True
End If...................
View 3 Replies
View Related
Dec 4, 2013
I need to make several exact duplicates of an existing worksheet which includes several form controls. Basic Copy/ Paste the worksheet works well but row heights are different and hidden rows are unhidden. Is there a way to make an EXACT duplicate ?
View 2 Replies
View Related
Jun 5, 2014
I have a worksheet with lots of things going on... the end user needs access to the Name field, DOB field, all the scroll and form control option buttons in the 9-question sheet, and the macro-enabled reset button at the bottom. Formulas are sprinkled throughout the worksheet, in columns T through AC... option button links go to AA and AB.
I would like to protect the entire sheet so none of the fields, except where indicated above, could be selected or edited... but when I protect the sheet, I get errors when trying to use you form controls, and the formulas do not respond. And finally, when protected, I get a debug error on the reset macro.
View 2 Replies
View Related