Copying/Clearing Information using Check Box (Form Control)

DarrylK

New Member
Joined
Mar 6, 2017
Messages
16
Hi I have the following conundrum:

I am creating a sheet that collects billing and shipping information and I want to use a check box that will copy the billing information to the shipping information section if the box is checked and delete the shipping information if the box is unchecked.

The simplified idea of the action is

-----------------------------------------

If (E18) on sheet.(Misc Data) = "True" Then

Copy Range C5:N11
Paste.Values C20:N26

If (E18) on sheet.(Misc Data) = "False" Then

Select F20, E22, E24, D26, I26, M26)
Clear.contents


-----------------------------------------

Assistance would be greatly appreciated!,

Have a great week!,
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Not sure the question but you can use the check box event, i dont know the exact name of the event but it would be something called like Checked, ValueChanged, etc
 
Upvote 0
Try this:
Assuming the ranges and the check box are both on sheet named:
Misc Data
And you have the Form control checkbox linked to E18 on active sheet.

Code:
Sub CheckBox1_Click()
If Range("E18").Value = True Then
Range("C5: N11").Copy Range("C20: N26")
Else
Range("F20, E22, E24, D26, I26, M26").ClearContents
End If
End Sub
 
Upvote 0
Not sure the question but you can use the check box event, i dont know the exact name of the event but it would be something called like Checked, ValueChanged, etc

This example can illustrate the way I usually handle form control checkboxes on a worksheet (on a basic level)~

Code:
Sub CheckBox1_Click()
MsgBox(ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.Value)
End Sub

And assign that macro to the checkbox (via right clicking)

Every time you click it with this code, It should display either 1 (true) or -4146 (false).
Using -- ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.Value -- Is super helpful to get dropDown values or checkbox values. You just have to assign the macro and it'll run on changes
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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