gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I have a checkbox1 I only want the code to run of the box is checked. (And have a message box if its not checked.) How do I put that If statement in?
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'
Dim LastRow As Long
'
LastRow = ActiveWorkbook.ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
'
Range("D9:D" & LastRow).FormulaR1C1 = _
"=IFERROR((IF(R[1]C[-1]>RC[-1],""Parent"",""Child"")),"""")"
Range("D9:D" & LastRow).Value = Range("D9:D" & LastRow).Value
Range("K8:K" & LastRow).FormulaR1C1 = _
"=IFERROR(((YEAR(RC[-1])-YEAR(RC[-2]))*12+MONTH(RC[-1])-MONTH(RC[-2])),"""")"
Range("L8:L" & LastRow).FormulaR1C1 = _
"=IFERROR((IF(RC[-3]<>"""",(IFERROR((MONTH(RC[-3])-MONTH(R2C[-8])+1+(YEAR(RC[-3])-YEAR(R2C[-8]))*12),"""")),"""")),"""")"
Range("M8:M" & LastRow).FormulaR1C1 = _
"=IF(AND(RC[-3]<>"""",R[-6]C[-9]<>""""),(MONTH(RC[-3])-MONTH(R2C[-9])+1+(YEAR(RC[-3])-YEAR(R2C[-9]))*12),"""")"
Range("K8:M" & LastRow).Value = Range("K8:M" & LastRow).Value
'
' Range("B" & LastRow + 1).Select
Dim Ind As Range
For Each Ind In Range("C8", Range("C" & Rows.Count).End(xlUp))
Union(Ind.Offset(, -1), Ind.Offset(, 2)).IndentLevel = Ind.Value
Next Ind
'
Sheets("Work Breakdown Structure").Protect
End Sub
Last edited: