samyjunior
New Member
- Joined
- Nov 12, 2017
- Messages
- 1
am using the active X checkbox
I am trying
- to put data on two cells on another sheet once the checkbox is checked
- remove the contents I pasted on the sheet if unchecked
- Paste information on the next row if content is full
here is what I did and its not working ::
private Sub CheckBox4_Click()
With ThisWorkbook.Worksheets("MSI")
Dim ab As Range
Dim bc As Range
If CheckBox4 = True Then
Dim dat As Variant
Dim rng As Range
Dim i As Long
Set rng = ThisWorkbook.Worksheets("Q").Range("A5:A100")
dat = rng
For i = LBound(dat, 1) To UBound(dat, 1)
If dat(i, 1) <> "" Then
rng(i + 1, 1).Value = " help needed"
rng(i, 2).Value = " dial :123"
rng(i + 1, 1) = ab
rng(i, 2) = bc
End If
Next
Else
ab.Value = ""
bc.Value = ""
End If
End With
End Sub
I am trying
- to put data on two cells on another sheet once the checkbox is checked
- remove the contents I pasted on the sheet if unchecked
- Paste information on the next row if content is full
here is what I did and its not working ::
private Sub CheckBox4_Click()
With ThisWorkbook.Worksheets("MSI")
Dim ab As Range
Dim bc As Range
If CheckBox4 = True Then
Dim dat As Variant
Dim rng As Range
Dim i As Long
Set rng = ThisWorkbook.Worksheets("Q").Range("A5:A100")
dat = rng
For i = LBound(dat, 1) To UBound(dat, 1)
If dat(i, 1) <> "" Then
rng(i + 1, 1).Value = " help needed"
rng(i, 2).Value = " dial :123"
rng(i + 1, 1) = ab
rng(i, 2) = bc
End If
Next
Else
ab.Value = ""
bc.Value = ""
End If
End With
End Sub