Erase a cell by pressing a button in Excel -


i'm working in excel. i'd press button cancel value of cell @ left of button itself.

so user experience should following:

when user presses "button1", cell @ left became 0. same "button2" , "button3" how can do? using macro?

assign macro , buttons, , it'll delete info. in cell directly left.

sub test()     dim btnrow&, btncol&     btnrow = activesheet.shapes(application.caller).topleftcell.row     btncol = activesheet.shapes(application.caller).topleftcell.column     cells(btnrow, btncol).offset(0, -1).clearcontents end sub 

or, @rory, can be:

sub test()     activesheet.shapes(application.caller).topleftcell.offset(0,-1).clearcontents end sub 

note: make sure shapes placed, uses wherever top left of shape determine row/column. macro reduces need run 3 different ones, depending on where, , minimizes if/then type statements uses caller determine shape, determines is.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -