Check Box Macro

ApolloID

Well-known Member
Joined
Jun 8, 2010
Messages
769
Hi, i need help with a macro that will run when a check box in sheet 1 is checked.

I have a check box (2) placed in "A9" and the linked cell is "B10"
I also have a check box (3) in "A11" and linked cell is in "B12"

I need a macro that will change the linked cell (row) height to 120.

If i click check box 2, then to adjust the height of the correspondant cell (row).

If i click check box 3, then to adjust the height of the correspondant cell (row).

Can this be done?

Thanks in advance!
 
Yes, you are right. The code in post 4 does that. I tried it again. And is working.

It didn't worked because i changed this line:
If Cells(Target.Row, "A") <> "" Then
with this:
If Cells(Target.Row, "A") <> "Note" Then

it was a mistake. :) Sorry.

Now, both codes are great and they work perfect.

One last request.
Can the height (on doubleclick) make autofit instead of a fixed height?

Thanks alot!
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi,

Can your code expand entire row only if i click a cell in row A?
Because i have another code that i need to work on doubleclick in column E.

Can this be done?

Thanks alot!
 
Upvote 0
Code:
If Target.Column <> 1 Then Exit Sub
will limit the macro to Column "A" only
That said, you can only have ONE BeforeDoubleClick event. So you will need to use Select Case
Code:
Select Case Target.Column
Case 1        'Column "A"
   'some code
 
Case 5        'Column "E"
   'Some code
 
Case Else:
End Select


lenze
 
Last edited:
Upvote 0
Thank you!
This is the code, and it's working:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Select Case Target.Column
   Case 5
      If Cells(Target.Row, "E") <> ">>" Then Exit Sub
      If Target.RowHeight <> 120 Then
        Target.RowHeight = 120
      Else:  Target.RowHeight = 15
      End If
   Case Else:
End Select
''''''''''''''''''''''''''''''''''''
Select Case Target.Column
   Case 7
        If Target.Value = "New" Then
            Target.Value = "Old"            
        Else
            Target.Value = "New"
        End If
   Case Else:
End Select
End Sub

Thank you for your help.
Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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