Macro For Checkboxes For Fix My Code

May 16, 2009

The following code attempt is in a userform with one print button, one cancel button and six checkboxes refering to which sheets that are needed to print.

View 2 Replies


ADVERTISEMENT

Global Code For Multiple Checkboxes

Apr 27, 2007

I'm working on a project that involves scheduling participants. The good news is that it doesn't have to be complicated at all. Here's some info.:

Each event can either be one person or a group of people. Also, one person could be in more than one group. The event can be either a brass, woodwind, percussion, strings, or vocal. Events are scheduled at 10 minute intervals. Since we don't take time requests, what I need is something that will plug in events (sorted by the type of event) to time slots. (Each event takes place in a different room) All it has to do is avoid scheduling a participant at the same time and there needs to be 20 minutes between when a particpant can perform again. (In other words, if they are scheduled at 8:00AM, they can't be scheduled again until 8:20.)

On the spreadsheet, Column A is the event name, Column B is the Event type (Brass, woodwind, percussion, strings, or vocal) and column C are all of the participants involved. I don't know much about VBA so this may be too much work for this kind of foum but the folks on this board always amaze me.

View 4 Replies View Related

Using A Macro To Insert Checkboxes?

Feb 11, 2013

I'm trying to use VB to create a macro that will insert check boxes automatically when data is entered in that row. The problem is that I have VERY little experience with VB code. Here's what I'm looking for:

When I enter data in box A2, I want to automatically put a check box in cells D2, F2, G2.
When I enter data in box A3, I want to automatically put a check box in cells D3, F3, G3.
(and so on....)

I have already found a macro that will put a check box in a particular cell, I just need to figure out how to do it automatically in the cells I want. Here's what I have to put the check boxes in:

Sub AddCheckBoxes()
On Error Resume Next
Dim c As Range, myRange As Range

[Code]....

I just want that to happen in the 3 cells in the same row that I enter data in automatically when I enter data.

View 2 Replies View Related

Adding Checkboxes By Macro

Jul 17, 2007

How to add checkbox to specific cells? I would like to add one checkbox to "A2" then "A5" then "A8".... upto 101.

View 9 Replies View Related

Delete Worksheets Using Checkboxes Macro?

Oct 13, 2008

I've altered a Print Worksheets Macro from the web to allow me to choose which worksheets I want to delete by selecting a checkbox. For some reason, though, the macro almost always deletes the last worksheet as well as the one selected.

[Code] ......

View 3 Replies View Related

Delete Worksheets Using Checkboxes Macro

Oct 13, 2008

I've altered a Print Worksheets Macro from the web to allow me to choose which worksheets I want to delete by selecting a checkbox. For some reason, though, the macro almost always deletes the last worksheet as well as the one selected.

View 2 Replies View Related

How To Uncheck Checkboxes With Date Macro

Feb 2, 2010

I am trying to create a bit of a tricky Excel Spreadsheet. I currently have a spreadsheet that records our battery recharging information(Crate #, Date last charged, Date for Recharge). This spreadsheet currently has a Macro that when opened sends an email to certain employees as to which crate requires charging. I would like to change it so that instead of manually entering the dates you check a checkbox and the next date automatically comes up. That part is easy. The difficult part is getting the checkbox to uncheck when the date for recharge passes. The code below unchecks the checkboxes but how do I modify it to uncheck when date is less than today?

View 11 Replies View Related

VBA Macro Code Needed To Run The Code Contained Within A Cell

Dec 17, 2008

I have a macro that, when run, needs to read the contents of cell B5, and run the code that it contains.

Cell B5, for example, would contain the text:
Range("B13").Formula = "SUM(D12:D14)"

I need a macro to "execute this code", as if it were in the macro itself.

I have assigned the above to a variable, but am not sure how to execute it.

EG.


Dim the_calc
the_calc = Range("B5").value

Now, how do I run the_calc ?

View 9 Replies View Related

Efficient VBA Code Vs Macro Recorder Code

Sep 9, 2007

What is the most efficient VBA code for the following macro recorded codes? I wish to write more efficient code versus the lengthy, cumbersome macro recorder code.

1) Macro Recorder Code to Copy One Sheet to Another

Sheets("Data Apple").Select
Cells.Select
Selection.Copy
Sheets("Banana").Select
Cells.Select
ActiveSheet.Paste

2) Macro Recorder Code for Replacement Purposes......................

View 9 Replies View Related

Create Macro Code With VBA Code

Feb 22, 2008

I'm trying to add buttons to an excel spreadsheet at runtime. Each row in the spreadsheet should have its own buttons. I was able to create and edit them with the ActiveSheet. OLEObjects.Add() function, but after that, when i was trying to create code dynamically to react on the buttons' click events excel crashes (actually it works for one button, but not if my routine for adding a new button and event code is called more than once in a row!)

The code below works if the AddCmdbuttonWithCode() is called once, but crashes if it is called two or more times. Excel tries to restore the document after the crash and the first button and its corresponding click event code is visible and works... but NOT the second button and its event code...

The only way I can create multiple buttons right now is by calling my method once per click, opening the vba editor, changing the parameters for my AddCmdbuttonWithCode() routine and execute it again. After that I have mutliple buttons in different lines which all work fine (so the concept seems to work).

The problem seems to be the insertLine method, since everything seems to work if i leave it out (except for the code generation of course, since this is done by this part of the code :-) ). Is it possible that calling the insertLine Method can't be called multiple times? I don't know... any ideas? Feel free to test my code - it's small, easy to understand and has comments.

'this code calls the method which creates the buttons in specific cells with specific names
Private Sub CommandButton3_Click()
'the first call always works!
AddCmdbuttonWithCode "Edit_111_111_114", 23

'the second one crashes excel
AddCmdbuttonWithCode "Edit_111_111_115", 27
End Sub

View 3 Replies View Related

Split Up Huge Macro Using Call Macro But Pivot Table Code Errors Out?

Jul 10, 2012

I'm using a CALL Macro to split up a HUGE macro into different pieces:

Code:
Sub RSLDASHBOARDV2()
'Macro recorded 12/14/2010 by Ryan R. Koleno, Pharm.D.
'Last Updated 7/10/12 by Ryan R. Koleno, Pharm.D.
'Do Not Modify Code Unless Given Proper Privileges to do so.
Dim APPSPD As Worksheet
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual

[code]...

The first few macros dealing with page setup and what not work fine but when it hits the Pivot table code for the STATSPIVOT macro it errors out stating: "Run-time error '1004': Unable to get the PivotItems property of PivotField class' at this point in the code:

Code:
objField2.PivotItems( _
"TRC").Position = 1
objField.PivotItems( _
"MEDCO MAIL OR AOB").Position = 2

When this macro is not split up it worked fine as written. Am I overlooking something in the Call Macro's code or is there a variable I'm not aware of. I have included the Pivot Table code that errors out as well.

Code:
Sub STATSPIVOT()
'STATS PAGE BASED ON STATS DATA TAB
Sheets("STATS DATA").Select
Dim objTable As PivotTable, objField As PivotField
ActiveWorkbook.Sheets("STATS DATA").Select
Range("A1").Select

[code]...

View 4 Replies View Related

Macro Coding: Add A Code To The Sort And Paste Macro That Will Open The Second Spread Sheet

Jul 21, 2007

I am making a spreadsheet that sorts and pastes, but I need to know if I can add a code to the Sort and Paste Macro that will open the second spread sheet needed without just already having it open and using the

Windows("estimate sheet one.xls").Activate

View 2 Replies View Related

Create Macro Button And Assigning Macro Code

Aug 10, 2014

Refer to attached file.

I have below code which successfully create a macro button and assign the macro correctly.

This is only doing for one sheet and i need to modify the code so that it does for all sheets of the workbook.

[Code] ....

Test Macro_Botton.xlsm‎

View 3 Replies View Related

Macro To Delete Vba Code - Macro Security Warning

Feb 7, 2008

I have recently grabbed the very helpful "Macro to delete VBA code" from this site, and it's working but with one small problem.

My worksheet runs a lot of code, then deletes all macro code and saves itself.

The problem is the next time i open I still get the macro security warning!

I've checked thoroughly and there is definatley no vba left anywhere.

If I open the document, enable macros, and save it, then open it again, I no longer get the warning.

View 9 Replies View Related

Allows Me To Place Checkboxes In Each Row

Jan 21, 2007

What I have is a long list of about 100 items. I would like to set up an excel sheet that allows me to place checkboxes in each row and then whatever checkboxes have been checked, to simply collate and print out ONLY the check boxes that have been checked.

I have gotten as far as to create and rename the checkboxes but my skill ends there. I also need to know how to get each checkbox to correspond to a row.

I appreciate ANY help that you can give me.

EDIT: this doesnt NEED to be checkboxes, it can be optionbuttons if that is easier... simply something to select/deselect and print.

1.1 a blah
1.1 b blah
2.1 a blah
2.1b blah
3.1a blah
3.1b blah
3.3.a blah
etc blah
etc

View 10 Replies View Related

Checkboxes Keep Printing Even Though Set Them To Not?

Feb 22, 2013

I have inserted checkboxes in an excel worksheet to turn on/off certain data. They are working just fine. But I have set them all to not print (by unselecting the checkbox that says "print" in the format dialogue). SOME of the checkboxes don't print, but most of them do. I can't figure out why.

I've attached the file so you can take a look.

View 3 Replies View Related

How To Process Checkboxes In VBA

Feb 11, 2014

how to handle checkboxes in VBA

I have a worksheet ("Sheet1") with an activex checkbox (CheckBox1) in cell B1

what code do I need to tell if the checkbox is ticked or not. (it probably should be some true / false type test but I keep not getting the syntax of the code correct.

what do I need to declare or set or ? to access the state of the checkbox

View 6 Replies View Related

Add Three Checkboxes To The Userform

Aug 25, 2008

I have a userform that contains 15 labels, each label has Numbers in it each time i click on a label the text is inserted into an excel spreadsheet. I use it as a fast input solution and works well and has done for a few years.

I Now want to Add three checkboxes to the userform
If checkbox One is ticked i want the letter "A" and the number in the label i choose to be inserted into the spreadsheet.
Checkbox Two "B"
Checkbox Three "c"

I would only ever tick one of the checkboxes never two or three so it would be A, B or C

This is the code for The Labels i use

View 13 Replies View Related

Checkboxes, Selecting

Aug 15, 2009

If I select checkbox1 I want checkbox3 to be false and vice versa, thats simple enough. Everytime I click on one or the other checkboxes I have to reselect the one I want.

It takes two clicks to get a checkbox checked (True).
My listbox will be populated by both lists in the "Checkboxes" code once I select a checkbox, then reselct to repopulate.

Checkboxes:

View 5 Replies View Related

Multiple Checkboxes

Jan 30, 2010

I have data on various KPI's achieved by diff states in different months.

I am looking an automatic way of loading the data upon selection of choices from the check boxes in the attached file.

Choice could be multiple from two different options available (Months & States).

If I select state 3 also in this, with months being same, state 3 data should automatically get appended in the data visible now.

View 12 Replies View Related

Looping Through Checkboxes In VBA

Nov 18, 2011

I have a worksheet that has multiple (form type) checkboxes on it, and I want to write code to loop through a specific range of them (Checkbox 26 to Checkbox 36 for instance), check if the value is true and then return the .Caption value to a message box, or ultimately a cell on another worksheet.

I can do it for all of the checkboxes on the ActiveSheet, but just can't figure out how to run through.

View 3 Replies View Related

VBA Checkboxes On A Worksheet

Mar 24, 2012

I've got several rows of checkboxes, I want to be able to select 1 checkbox on a row and the others not to be selected, or if they are it automatically deselects them, and then I want to select 1 checkbox on the next row and so on.

View 9 Replies View Related

Looping Through Checkboxes

Apr 18, 2013

I don't understand why this code doesn't work:

Sub All()
Dim chk As CheckBox

For Each chk In ActiveSheet.CheckBoxes
CheckBox.Value = Checked
Next

End Sub

All I want to do is loop through all the check boxes on a sheet and check them. But the code acts as if there are no check boxes on the active sheet, I don't get any error messages it just never lands on the

"CheckBox.Value = Checked" line.

View 3 Replies View Related

Userforms And Checkboxes

Jul 10, 2007

I'm having trouble with checkboxes - I've set up the userform but I can't seem to get it to send values to the specific cells when certain options are checked.

The way it should work is there will be an action and this could be involved with 1 process or 40 processes (and anything in between) and what will happen is the userform will pop up and ask what processes the action is applicable to. The user will then tick the correct ones and the form will then place these values in the corresponding cells next to the action.

View 9 Replies View Related

Userform And Checkboxes

Nov 25, 2007

a. I m trying to put up a userform that a. select different autofilteroptions (I'm using checkboxes)
b. let the user to do som autofiltering of several workbooks (the workbooks are similar regarding structure and formats).
c. take a copy of the result from the autofilter result
d. paste this in a new workbook
e. go to next workbook, do b. and c. and paste this under the result from the last session.

View 4 Replies View Related

Interactive Checkboxes

Dec 6, 2007

I am trying desperately to link activex checkboxes I have in an excel spreadsheet to a textbox. I need a textbox in cell K11 to appear whenever the checkbox in cell H11 is marked. Is this possible to create in excel using VBA?

View 9 Replies View Related

Checkboxes And Loop

Dec 19, 2007

I have one Sheet for each day of the month, named 1,2,3,4 and so on. Each Sheet is copied from the second Sheet upon creation, so they are all the same, except for the first sheet. On each Sheet there are a couple of checkboxes (four at the moment) placed at the same position och each Sheet.

If, let's say the first checkbox on Sheet 6 is checked, then the next seven Sheets checkboxes that is placed on the same spot should become triple-state. I want this to happen in real-time, not when the Sheets are copied/created. In other words, when I click a checkbox on any given day (Sheet), the next seven checkboxes on the upcoming 7 Sheets should change state.

This is to say "this is ok for seven days, and if there has gone 7 days since the last click - the checkbox is empty.

View 9 Replies View Related

Hiding Checkboxes

Jul 21, 2008

I am trying to use the following
[code] ....

and modifying it to:

If Sheets("TPM").Range("al13").Value = 2 Then ActiveSheet.Shapes("Check Box 391").Visible = True

The first one works OK, but when I try to add an if / then statement, it gives me an error message.

I want to hide Check boxes 391 through to 426, using a single macro.

View 9 Replies View Related

Naming Checkboxes

Dec 22, 2008

Basically my code creates a load of checkboxes and I need to name them appropriately as they will be used in the next part of the code.

I haven't had a problem changing the caption properties etc but I need the name to be meaningful and unique - it works fine if I just want each checkbox to be called i.e. "CB1" etc but I want the name to be derived from a range within the worksheet.

Below is an extract from the
the_row = 10
For Each Item In ActiveSheet.OLEObjects
If Item.progID = "Forms.CheckBox.1" Then Item.Name = WorksheetFunction.Substitute(ActiveSheet.Range("C" & the_row).Value, " ", "_")
If Item.progID = "Forms.CheckBox.1" Then Item.Object.Caption = ""
If Item.progID = "Forms.CheckBox.1" Then Item.PrintObject = False
the_row = the_row + 1
Next

Column C contains the name which is unique to each checkbox, I simply need to replace any spaces with "_" but when I am not defining a set text string the name of the checkbox does not change.

View 9 Replies View Related

Checkboxes On The Worksheet

Feb 4, 2009

I've been trying to make this work for several hours now and it's not throwing errors at me any more, it just doesn't work. I put a couple of checkboxes on a worksheet and am trying to identify which are checked and which are not, so that I can do something with the rows that they are located on. I'm pretty sure the rest is right, I just can't get it to identify the checkboxes as checkboxes for some reason. Eventually there will be many checkboxes, but I'm trying to get the code right before I add more. Anyway, the checkboxes are from the Control Toolbox. I looked through the forums and archives but didn't find anything that would work. If anyone could help me

Dim btn as Shape
Dim num as Integer
Dim ckbx as CheckBox

With Worksheets("AC")
For Each btn In .Shapes
If btn.Type = msoFormControl Then
If btn.FormControlType = xlCheckBox Then
For num = 1 To 150
Set ckbx = .CheckBoxes("CheckBox" & num)
If ckbx.Value = xlOn Then
End If
Next num
Else
MsgBox("bugs")
End If
Else
MsgBox("bugs")
End If
Next btn
End With

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved