Very new to writing macros, trying to impress the boss with a project, but I am stuck with a code. I can hide the rows when the checkbox is selected, but the other checkboxes are still visible. Is there a way to hide other checkboxes as well. My current code:
Private Sub CheckBox20_Click()
If CheckBox20.Value = True Then
Range("A64:P82").EntireRow.Hidden = True
End If
If CheckBox20.Value = False Then
Range("A64:P82").EntireRow.Hidden = False
End If
End Sub

I want to hide CheckBox22 - CheckBox34.

Recommended Answers

All 2 Replies

You need to use the following methods:

With ActiveSheet
.Range("C7").Value = .Range("C8").Value
.Range("D7").Value = .Range("D8").Value
.Range("E7").Value = .Range("E8").Value
.Range("F7").Value = .Range("F8").Value
End With

I have tested the macro and the checkboxes still appear when the rows are hidden:
Private Sub CheckBox20_Click()
If CheckBox20.Value = False Then
Range("A64:P82").EntireRow.Hidden = True
End If
If CheckBox20.Value = True Then
Range("A64:P82").EntireRow.Hidden = False
End If
With ActiveSheet
.Range("E65").Value = .Range("F65").Value
.Range("E70").Value = .Range("F70").Value
.Range("E73").Value = .Range("F73").Value
.Range("E76").Value = .Range("F76").Value
.Range("E79").Value = .Range("F79").Value
.Range("E82").Value = .Range("G82").Value = .Range("I82").Value
End With
End Sub

Perhaps I have written it incorrectly? Should it be two separate macros or is one as I have done okay?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.