Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
need help with macro (checkboxes)
I would like to create automatically a checkbox per row but also if
the checkbox is selected I want to hide columns J to K, I got this code but I don't know how to change it to put the condition about hiding the columns. could anybody help me... this is the code : Sub add_checkbox() On Error Resume Next Dim c As Range, myRange As Range Set myRange = Selection For Each c In myRange.Cells ActiveSheet.CheckBoxes.Add(c.Left, c.Top, c.Width, c.Height).Select With Selection .LinkedCell = c.Address .Characters.Text = "" .Name = c.Address End With c.Select With Selection .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, Formula1:="=" & c.Address & "=TRUE" .FormatConditions(1).Font.ColorIndex = 6 'change for other color when ticked .FormatConditions(1).Interior.ColorIndex = 6 'change for other color when ticked .Font.ColorIndex = 2 'cell background color = White 'I think here should be the hiding option but i don't know how to write it End With Next myRange.Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Checkboxes disappear after macro is run | Excel Programming | |||
Macro to clear checkboxes | Excel Worksheet Functions | |||
Multiple checkboxes, one macro? | Excel Programming | |||
Checkboxes to spreadsheet using a looping macro | Excel Programming | |||
Multiple checkboxes 1 macro | Excel Programming |