Skip to content

Instantly share code, notes, and snippets.

@DouglasdeMoura
Created July 6, 2015 13:53
Show Gist options
  • Save DouglasdeMoura/d760f337d0f402c7b2c2 to your computer and use it in GitHub Desktop.
Save DouglasdeMoura/d760f337d0f402c7b2c2 to your computer and use it in GitHub Desktop.
Get row and col of a button when clicked
Public Function ButtonRow()
Dim b As Object, RowNumber As Integer
Set b = ActiveSheet.Buttons(Application.Caller)
With b.TopLeftCell
RowNumber = .Row
End With
ButtonRow = RowNumber
End Function
Public Function ButtonCol()
Dim b As Object, cs As Integer
Set b = ActiveSheet.Buttons(Application.Caller)
With b.TopLeftCell
cs = .Column
End With
ButtonCol = RowNumber
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment