![]() |
|
#1
|
|||
|
|||
|
Hello,
I am new to macros, can some one help me to write a macro for the following task. Assign a check-box to a cell and whenever the box is checked i wanted the value to be equal with cell (example E5). Whenever the box is unchecked i wanted the cell to be empty or zero. Is it possible please? |
|
#2
|
|||
|
|||
|
What part of this do you need a macro for?
Put a Form Controls Checkbox on B5 In the check box properties make the linked cell B5. Format B5 text same color as back ground so it's not distracting. Put formula in C5 =IF(B5=TRUE,E5,"") |
|
#3
|
|||
|
|||
|
Using it for a pricing list. Tick the boxes for product i need.
Thank you, it work |
|
#4
|
|||
|
|||
|
If you have a lot of check boxes to put on your sheet, maybe you can make use of this macro I came across in the forums long time ago.
Play around with it in a blank workbook, it can be handy. Code:
Private Sub Insert_Checkboxes()
Dim myCell As Range
Dim myRng As Range
Dim CBX As CheckBox
With ActiveSheet
'delete existing checkboxes from sheet, links are not cleared.
.CheckBoxes.Delete
'Exit Sub '<~~~~~ uncomment to delete checkboxes only. Linked cells are NOT cleared.
Set myRng = .Range("A2:A11") '<~~~~~ enter the range to have checkboxes
End With
Application.ScreenUpdating = False
For Each myCell In myRng.Cells
With myCell
Set CBX = .Parent.CheckBoxes.Add _
(Top:=.Top, _
Left:=.Left, _
Width:=.Width, _
Height:=.Height) 'click area same size as cell
CBX.Name = "CBX_" & .Address(0, 0)
CBX.Caption = "Label goes here" 'or whatever you want
CBX.Value = xlOff 'initial value unchecked
CBX.LinkedCell = .Offset(0, 1).Address '<~~~~~ enter offset to linked cell
End With
Next myCell
Application.ScreenUpdating = True
End Sub
|
|
| Tags |
| cell, checkbox, macro |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Macro to add title in header is missing text once macro is run | shawnee24 | Word VBA | 3 | 05-27-2015 12:35 PM |
Macro Question: Need help making a macro to highlight the first word in every sentence
|
LadyAna | Word | 1 | 12-06-2014 10:39 PM |
| Macro Needed to bold specific lines and Macro to turn into CSV | anewteacher | Word VBA | 1 | 05-28-2014 03:59 PM |
| custom icon, undo/redo for macro, permanent macro | Rapier | Excel | 0 | 08-05-2013 06:30 AM |
| How do I assign a macro to a button when the macro is in my personal workbook? | foolios | Excel Programming | 2 | 07-27-2011 02:41 PM |