So I have a spreadsheet driven by some data-entry cells and macros, whereby information from the input forms is added to a table... As part of this process, I want to create a standard button (form control) that can later be clicked to delete the associated row (i.e. the table entry)...
Here's where I'm at, and I haven't been able to figure out what's wrong with it:
Dim ButtonObject As Object
Dim cs, rs As Integer
Set ButtonObject = ActiveSheet.Buttons(Application.Caller)
With ButtonObject.TopLeftCell
rs = .Row
cs = .Column
End With
Range(Cells(rs, cs)).EntireRow.Delete
The debugger keeps stopping on the last line, but I don't know why...
EDIT - FIGURED IT OUT, NEVERMIND
Turns out I was trying too hard... The following worked just fine:
Dim ButtonObject As Object
Set ButtonObject = ActiveSheet.Buttons(Application.Caller)
ButtonObject.TopLeftCell.EntireRow.Delete
Here's where I'm at, and I haven't been able to figure out what's wrong with it:
Dim ButtonObject As Object
Dim cs, rs As Integer
Set ButtonObject = ActiveSheet.Buttons(Application.Caller)
With ButtonObject.TopLeftCell
rs = .Row
cs = .Column
End With
Range(Cells(rs, cs)).EntireRow.Delete
The debugger keeps stopping on the last line, but I don't know why...
EDIT - FIGURED IT OUT, NEVERMIND
Turns out I was trying too hard... The following worked just fine:
Dim ButtonObject As Object
Set ButtonObject = ActiveSheet.Buttons(Application.Caller)
ButtonObject.TopLeftCell.EntireRow.Delete
Last edited: