On Button Click(Help!)

J

jpizzle

Hey everyone,

I was wondering if you guys could help me out with a problem I have. I
was wondering if it would be possible to have a button such that excel
will locate which cell the button is over and insert a row above that
cell. Is there a VBA function that returns the location of the cell
where the mouse was clicked? Thanks a lot!
 
J

jindon

Hi

paste the code onto sheet module

Code
-------------------

Private CellNow As String

Private Sub CommandButton1_Click()
Range(CellNow).EntireRow.Insert
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
CellNow = Target.Address
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top