Resizing A Form To Fit A Variable Number Of Checkboxes
Jun 7, 2006
create a form that will look at the spreadsheet and figure out which of the 32 possible checkboxes will be used and resize accordingly. I can make it so that only the checkboxes I want are visible using the .visible property, but for the sake of aesthetics I'm wondering if there is a way to disable the checkboxes I don't want and to resize the form to fit the checkboxes I do want. I just don't want a form that looks like it has checkboxes put on it at random spots.
Is it at all possible to create a User Form where the number of CheckBoxes will be linked to the number of entries in a cell range?
For example I have a 3 records in the range A:A called "Blue", "Green", "Yellow". I want to have a user form with 3 CheckBoxes with the same caption names.
I have a sheet with around 3,000 rows of data. I need to be able to enable/disable different comibinations of three checkboxes based on the value of a cell in column D as follows:
If Band says £0k - £75k then all three check boxes should be disabled If Band says £75k - £250k then the Step 1 check box should be enabled but the Step 2 and Step 3 check boxes should be disabled If Band says £250k - £500k then the Step 1 and Step 2 check boxes should be enabled and the Step 3 check box should be disabled If Band says £500k plus then all three check boxes should be enabled
When a checkbox is disabled I'd like it to appear visible but greyed out so it is obvious the option is not available, maybe via conditional formatting. I don't know if this can be achieved within any code rather than having to manually add conditional formatting afterwards?
I've attached a sample to demonstrate. Is this possible to achieve? I'm open to alternative approaches as well if this makes things easier to do. The mere idea of adding 9,000 plus check boxes if already scary!
I'm developing a workbook containing 121 sheets. Sheet 1 is effectively an index, and uses 120 form control checkboxes to unhide and display the selected sheets individually.
The code I'm using for each checkbox is below and is in a module.
I have a multi-worksheet workbook that has many forms control checkboxes throughout it. I'm looking for some VBA that will change the background (fill) color of ALL the checkbox when it is checked (True). I've seen code for a single checkbox, but not multiple/all boxes. I know just enough VBA to be dangerous, but I'm up to learning anything new.
I had a question earlier regarding how to call a form using a variable rather than the form name. This works correctly and the form is displayed, however the forms behaviour deviates from the code within the form.
I have attached a simple example which permits a user to determine where on a page a form displays, if called using the form name directly it functions correctly, appearing at the designated co-ordinates. If it is called indirectly using the variable it reaches the line
I have 110 checkboxes on a sheet. User checks some of them. After he is done, I need to know the total number of boxes checked. I wrote a simple loop but there is some little error. Essentially I am trying to have Sub go box by box and see which one of them is checked:
With ActiveSheet b = 0 For i = 1 To 110 If .Shapes("Checkbox" & i).OLEFormat.Object.Object.Value = True Then a = 1 End If Next i b = b + a MsgBox b End With
On the attached Excel file, I have code that will insert a variable number of rows and copy and paste from and to variable positions. That all works fine when run from a command button, but when I try to run it from the Worksheet_Calculate by entering 1 in J1 or K1 (inrange cell is J1+K1 for testing purposes) the CommandButton1_Click sub runs continously until an error occurs.
I have a spreadsheet with about 30 charts on it that I would like to attach a macro to which opens the chart in a form. I've figured out how to do this last part, but am stuck on how to pass a variable to the form code which tells excel which chart to copy. Essentially what I'm doing creating a macro for each chart which would run when that chart is clicked on. This macro is identical for each chart except for the name of the chart being passed.
Sub Chart1_click() ShowChart "Chart 1" End Sub
Sub ShowChart(c As String) frmChart.Show End Sub
In the UserForm_Initialize code located in the userform module, I'd like to call the code which saves and loads the image of the clicked on chart. But here's where I'm stuck. How do I pass c to the code in the form module...e.g, how to pass c to UserForm_Intialize and to ChartZoom? Here's what I have so far...
Private Sub UserForm_Initialize(c As String) ChartZoom c End Sub
Private Sub ChartZoom(c As String)
frmChart.Show
Dim Cht As Chart Set Cht = ActiveSheet.ChartObjects(c).chart Dim CName As String CName = ThisWorkbook.Path & "cht.gif" Cht.Export Filename:=CName, FilterName:="GIF" imgCht.PictureSizeMode = fmPictureSizeModeZoom imgCht.Picture = LoadPicture(CName)
I have a custom data entry form which is working fine. The form completes customer data for reviewing at a later date. I have now been asked to change it so it will seperate the data in to customer's who require some documents sent out and some that dont.
Is it possible to have a combobox on the form and if the options on the combobox are Yes and No (original), when either option is selected the data will complete on to a seperate sheet for cases with documents required or documents not required?
I am using a variable named " Totals" as a range type to refference the range in a formula. It works the way I have it.
Dim Totals As Range Set Totals = [U37: AE37]
Now instead of the absolute refference, I would like to change the row refference by an offset of my current row, using a formula with a varriable. The columns stay the same.
I can't find a way to re-size the name box (the one in the top left hand corner of a spreadsheet, to the left of the formula bar), or change the type size that this box uses.
I've looked through Excel help, but I can only find help on re-sizing toolbars and not the name box.
I now have 5 textboxes "on top" of one other (i.e. vertically arranged). I would like to - depending on which checkbox is checked - extend the top one all the way down and make the bottom four invisible. I'm pretty sure I can handle the second part:
I am trying to copy down a range of formulae using the resize function. Here's the code I have :-
Code: Dim no_of_transactions As Long no_of_transactions = Last_Row_of_data(main_workbook.Sheets("working").Range("g2")) main_workbook.Sheets("working").Range("w2:ak2").resize(no_of_transactions,1)
However I am told by the vba editor that I need an = sign ? The function Last_Row_of_data tells me the number of rows that I have.
I have a worksheet named Advisers with a range also named Advisers, the range is a list of names which is added or deleted from by use of a UserForm.
I have the following lines of - The first populates the worksheet and The second is supposed to resize the range Advisers accordingly but it gives a Run-time error I've tried the 2 examples below
= SUMIFS(E9:E1494,C9:C1494,1) This formula works ok. If I rename range E9:E1494 as "Col_1" and change the formula to =SUMIFS(Col_1,C9:C1494,1). I get #VALUE error. The range is formatted as number.
Also ...
If I delete some cells in a range, referring formulae are modified accordingly, but if I add cells in the range the formulae do not recognize the change
Is it possible to re-size a non-contiguous range? I'm guessing "no", and a Google trawl hasn't provided me with anything.
Here's what I'm trying to do:
dim mult_rng as range dim rng2 as range
set mult_rng = range("A1:B1,D1:E1") set rng2 = mult_rng.resize(rowsize:=10) That is, my original range is comprised of non-contiguous cells in the same row. When re-sizing, I'm trying to increase the number of rows, but leave the columns the same.
Like I said, my gut instinct says that this isn't possible using the 'resize' property. Can anyone think of another method to use? My constraints are that the original mult_rng isn't always the same (and isn't always non-contiguous).
I have created this Excel schedule that is attached. The point of the schedule is to organize Jobs and Crew members. I have VBA code in, so when I calculate how long the job should take, the arrows next to the job will automatically extend. (This should all make sense if you take a look at the attachment.) The only problem is that my arrows do not extend the correct distance. In the attached file I have scheduled "James Lorenz" to do a job starting on tuesday, towards the bottom of the page I did my calculation that figures he should be on that job for 9.5 days. I would like the Arrow next to James' job to extend 9.5 days on the calender instead of 9.5 centimeters or whatever it is doing now.
Lets say i type for now... A1 = USA B1 = Philippines
and then later A1 = dog B1 = cat
Is there a way that the width would automatically adjust even as I change the values of the given cells; meaning, if a word is long, the width will automatically adjust "longer", if a word is short, then it will automatically adjust "shorter".
I know how the "AutoFit Column Width" works but I don't want to press that every time my values change (words becoming shorter or longer).
I finally have the merged cells resizing the way I need, however it seems to lock the cell after the process not allowing it to be edited again until I unlock the sheet. below is the current code I am using
1) Is it possible to write a macro that will resize fonts in a chart (axes, text boxes) to specific sizes?
2) I usually copy chart sheets and paste them into Publisher but I have to resize them because they are huge when pasted. I would like to create a toolbar command that will take the selected chart sheet (not just a chart in a worksheet) and resize it and its components (part 1) to specific dimensions, then copy it as a picture so that I can simply go to Publisher and paste the chart after pressing said button in Excel.
I have made charts in VBA charts that needs to be placed on specific position and have specific sizes on a chartsheet. I use plotarea (top, left, width, height) for that. Unfortunately when I set these values they keep chaning, there is some scaling going on in Excel and they won't get the specified size. I have been looking on the internet and finally I found a piece of code which works, but still not good enough, because the legend is also not good positioned
De data for resizing the new charts (ChtNew), the legends and the charttitle I get from other charts (ChtOrig). The legend.legendposition of ChtOrig does not have a value but it still have a top,left,height en width which I use.
I show you my code, the part with the for-next is taken from the internet. I am trying to find a solution now for 3 days and now I only dream of huge charts (which is not good). So please can someone help me with this? This is the last forum, that I can try, I didn't get reactions from others.
with ChtNew.legend .Top = ChtOrig.Legend.Top .Height = ChtOrig.Legend.Height .Left = ChtOrig.Legend.Left .Width = ChtOrig.Legend.Width '* 1.1 .Top = ChtOrig.Legend.Top + ChtOrig.ChartTitle.Top end with
I am using the Column() Function for referencing purposes... what I want this function to do is return the "letter form" of the column position rather than the "number Form"... is there anyway to change this without switching to R1C1 form?
I have a userform with a spreadsheet in it and I am inserting data into a workbook(my data base) with this application. In the spreadsheet changing event I used "0.00" number format (this is what I need) but the results after I type a number is diferent from what I just typed. i.e: if I type 13.56 there is no problem but if i type 6.56 the number is transformed to 20607.00. I have tryed a lot of methods to stop doing that but all of them failed. how to use decimal number format without this problem