Check Box Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,
I need a macro that will allow me to asign a check box to a specific row and when I check the box centain cells in that row will be sent to another sheet. I need to do this with multiple rows on multiple sheets with all info going to one sheet.
 
If you use a checkbox from the forms toolbar

Public Cbox_click()
Dim cBox as CheckBox
set cBox = Application.Caller
Dim rng as Range
set rng = Cells(cbox.TopLeftCell,1)
rng.Range("A1,D1,F1:H1").Copy Destination:= _
worksheets("Master").Cells(rows.count,1).End(xlup)(2)
End Sub

assign this to all you checkboxes. Place the checkbox on the row you want
it to refer to.

Regards,
Tom Ogilvy

Jason Watts said:
Hello all,
I need a macro that will allow me to asign a check box to a specific row
and when I check the box centain cells in that row will be sent to another
sheet. I need to do this with multiple rows on multiple sheets with all
info going to one sheet.
 
Tom
Every time I run the macro I get a Compile error: Invalid outside procedure at Set cBox = Application.Calle
 
Had a couple of typos in the procedure:

Public Sub Cbox_click()
Dim cBox As CheckBox
Dim rng As Range
Set cBox = ActiveSheet.CheckBoxes(Application.Caller)
Set rng = Cells(cBox.TopLeftCell.Row, 1)
rng.Range("A1,D1,F1:H1").Copy Destination:= _
Worksheets("Master").Cells(Rows.Count, 1).End(xlUp)(2)
End Sub

Might want to add:

Public Sub Cbox_click()
Dim cBox As CheckBox
Set cBox = ActiveSheet.CheckBoxes(Application.Caller)
if cbox.Value = xlOn then
Dim rng As Range
Set rng = Cells(cBox.TopLeftCell.Row, 1)
rng.Range("A1,D1,F1:H1").Copy Destination:= _
Worksheets("Master").Cells(Rows.Count, 1).End(xlUp)(2)
End if
End Sub

Also format the checkbox so, under protection, the choice is "don't move or
size with cells" if your checkbox overlaps a cell you are copying (or it
might get copied).




--
Regards,
Tom Ogilvy

Jason Watts said:
Tom,
Every time I run the macro I get a Compile error: Invalid outside
procedure at Set cBox = Application.Caller
 
Back
Top