Add button to bottom of spreadsheet to delete blank lines auto

G

Guest

How can i add a button to the bottom of a spreadsheet which will
automatically delete/add blank lines when activated. Therefore you can click
it whenever you need to use this in a spreadsheet template?
 
G

Gord Dibben

I believe you would need two buttons.

One for deleting blank rows and one for inserting blank rows.

There is a built-in button for inserting rows.

Tools>Customize>Commands>Insert.

Drag the Insert Rows button to your Toolbar.

For a delete blank lines macro, record yourself selecting a column and
F5>Special>Blanks>OK>Edit>Delete>Entire Row.

You'll get this code which you assign to a button.

Sub Macro1()
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
End Sub


Gord Dibben MS Excel MVP
 

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