linking checkbox to the row it is on?

02-23-2012, 09:12 AM
What I'm trying to do -

I have a checkbox on cells b6 through b100. I'd like to be able to clear or insert employee schedules based on which checkbox is checked/unchecked. I've figured everything out except for how to write code that will work for all rows... I really don't want to write 94 different macros for each row. I don't know if there is any way of using the location of the checkbox... kind of thinking no as technically you could put a checkbox in between or covering multiple cells.

For example, if the checkbox was in cell b12, I'd want to clear J12:BE12. Problem is, the active cell might be K37, in which case the macro would clear range J37:BE37. Anyone have any ideas? Thanks.

Sub clear_schedule()

Range("J" & ActiveCell.Row & ":BE" & ActiveCell.Row & "").ClearContents

End Sub

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum