location of custom button

  • Thread starter Thread starter keyur
  • Start date Start date
K

keyur

hi

how can i always place a custom button in the last empty
cell in a specific row (which will be filled in by a
macro)? the option "move and size with cells" doesnt seems
to work.

thanks
 
Assuming the button is a Button from the forms toolbar with a name of Button
1

set rng = cells(rw,"IV").End(xltoLeft)(1,2)

With activesheet.Buttons("Button 1")
.Top = rng.Top
.Left = rng.Left
End With
 
Here's some code to place a custome buttonm next to the last cell

With Cells(Rows.Count, "A").End(xlUp).Offset(0,1)
Application.CommandBars("Forms").Visible = True
ActiveSheet.Buttons.Add(Left:=.Left, Top:=.Top, Height:=13,
Width:=50).Select
Selection.Caption = "Print"
Selection.OnAction = "myPrintMacro"
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Back
Top