Hi --
My ThisWorkbook now looks like this.
Sub move()
ActiveWorkbook.ActiveSheet.Columns("A:Z").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft
End Sub
Private Sub Workbook_AddinInstall()
On Error Resume Next
'First thing the code does is remove the button if it hasn't been removed already
Application.CommandBars("Worksheet Menu Bar").Controls("MyMacro").Delete
'The above line results in an error if it has already been removed
'So this On Error Resume Next ignores if there's an error and just resumes starting below
Set MyMacro = Application.CommandBars("Worksheet Menu Bar").Controls.Add
With MyMacro
.Caption = "My Macro Button Name"
.Style = msoButtonCaption
.OnAction = "MyMacro" 'In your case this would be "move"
End With
End Sub
Private Sub Workbook_AddinUninstall()
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("MyMacro").Delete
End Sub
So now i need to find out how to create a cmd button and where to put it!!! cheers!
Bookmarks