dcmHRA
04-20-2005, 03:59 PM
OK, this is what I'm attempting to do....
When I click a "button" (created from the "Forms" toolbar), I want the cell that contains the "button" to be selected. Is there a way to do that?
My original formula looked like this:
ActiveWorkbook.Save
ActiveSheet.Unprotect
Selection.End(xlToLeft).Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireRow.Delete
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
MsgBox "Was the info deleted correctly? If not, please close the file without saving.", vbYesNo, "NOTICE!"
However, my coworkers believe it is too hard to select a cell and press ctrl+q to get the macro to run...
So I thought a button would be easier....This is what I have now, but it doesn't work!!!
ActiveWorkbook.Save
ActiveSheet.Unprotect
CommandButton.TakeFocusOnClick.End(xlToLeft).Select
Range(Selection, CommandButton.SpecialCells(xlLastCell)).Select
CommandButton.EntireRow.Delete
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
MsgBox "Was the info deleted correctly? If not, please close the file without saving.", vbYesNo, "NOTICE!"
Also, to add to my exciting project....Is there a way to have a macro run when "NO" is selected on the final Message Box?
Don
When I click a "button" (created from the "Forms" toolbar), I want the cell that contains the "button" to be selected. Is there a way to do that?
My original formula looked like this:
ActiveWorkbook.Save
ActiveSheet.Unprotect
Selection.End(xlToLeft).Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireRow.Delete
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
MsgBox "Was the info deleted correctly? If not, please close the file without saving.", vbYesNo, "NOTICE!"
However, my coworkers believe it is too hard to select a cell and press ctrl+q to get the macro to run...
So I thought a button would be easier....This is what I have now, but it doesn't work!!!
ActiveWorkbook.Save
ActiveSheet.Unprotect
CommandButton.TakeFocusOnClick.End(xlToLeft).Select
Range(Selection, CommandButton.SpecialCells(xlLastCell)).Select
CommandButton.EntireRow.Delete
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
MsgBox "Was the info deleted correctly? If not, please close the file without saving.", vbYesNo, "NOTICE!"
Also, to add to my exciting project....Is there a way to have a macro run when "NO" is selected on the final Message Box?
Don