954,301 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need help with Excel Macro

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.

Gizzle72
Newbie Poster
6 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

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

harryhyden
Newbie Poster
2 posts since Sep 2011
Reputation Points: 10
Solved Threads: 1
 

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?

Gizzle72
Newbie Poster
6 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: