How do I get my Checkbox If/Then to work?

rts1

New Member
Joined
Aug 12, 2011
Messages
6
I have a form with several input boxes in it. Code for each input looks like this:



Sub addslabthk()
Application.ScreenUpdating = False
'
'addslabthk macro
'
Dim i, k As Long
i = 1
k = AddHorizontalItemForm.TextBox2
For i = 1 To k
ActiveCell.Rows("1:1").EntireRow.Copy
ActiveCell.Rows("1:1").EntireRow.Insert Shift:=xlDown
Application.CutCopyMode = False
ActiveCell.Offset(0, -88).Range("A1").FormulaR1C1 = "=RC[89]"
ActiveCell.Offset(0, -67).Range("A1").FormulaR1C1 = "=RC[70]"
ActiveCell.Offset(0, -61).Range("A1").FormulaR1C1 = "=feet(RC[62])*12"
ActiveCell.Offset(0, 1).Range("A1").FormulaR1C1 = "slab Thick"
ActiveCell.Offset(1, 0).Range("A1").Select
Next i

ActiveCell.Rows("1:1").EntireRow.Copy
ActiveCell.Rows("1:1").EntireRow.Insert Shift:=xlDown
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False

End Sub
_____________________________________________________________

I have just added checkboxes to my form next to each input box with a header of "No Row" If checked, I want to eliminate this part of the code:

ActiveCell.Rows("1:1").EntireRow.Copy
ActiveCell.Rows("1:1").EntireRow.Insert Shift:=xlDown
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
______________________________________________________________

I currently am using:

Sub addslab()
Application.ScreenUpdating = False
'
'addslab macro
'
'
Dim i, k As Long
i = 1
k = AddHorizontalItemForm.TextBox1
For i = 1 To k
ActiveCell.Rows("1:1").EntireRow.Copy
ActiveCell.Rows("1:1").EntireRow.Insert Shift:=xlDown
Application.CutCopyMode = False
ActiveCell.Offset(0, -88).Range("A1").FormulaR1C1 = "=RC[89]"
ActiveCell.Offset(0, -86).Range("A1").FormulaR1C1 = "=RC[89]"
ActiveCell.Offset(0, -61).Range("A1").FormulaR1C1 = "=feet(RC[62])*12"
ActiveCell.Offset(0, 1).Range("A1").FormulaR1C1 = "SLAB"
ActiveCell.Offset(1, 0).Range("A1").Select


'If CheckBox1.Value = False Then
ActiveCell.Rows("1:1").EntireRow.Copy
ActiveCell.Rows("1:1").EntireRow.Insert Shift:=xlDown
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
'If CheckBox1.Value = True Then

Next i

End Sub
______________________________________________________________

However, regardless if the box is checked or not, it still leaves a blank row on the chart as the above code tells it. Is something off with my "If-Then?" Thanks.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,224,547
Messages
6,179,436
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top