View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Relative positions from a button

the button has both TopLeftCell and BottomRightCell properties.

You could use that

Sub Btn_click()
Dim btn as Button, rng as Range
set btn = Activesheet.Buttons(application.Caller)
set rng = btn.TopLeftCell
rng.offset(0,1).Value = rng.offset(0,1).Value + 1
End Sub

as an example, could be assigned to any such button designed to perform this
function.

--
Regards,
Tom Ogilvy


"Steve" wrote:

Hi,
I have a button (currently a form button but could be changed) on a sheet
that adds 1 to a value elsewhere on the sheet. This setup is replaicted for
other rows.
the macro currently increments the value by using the offset method relative
to A1.
I would like to know if there is a way to do increment the value using the
relative position to the button either by assigning the button to a cell or
another way?

Thanks