Thread: Combine 2 macro
View Single Post
  #3   Report Post  
bioyyy
 
Posts: n/a
Default Combine 2 macro

Don,
Thanks, but still don't get it:

Here are the macro:

Sub Duplicate()
'
' Duplicate Macro
'
' Keyboard Shortcut: Ctrl+c
'
Sheets("Sample List").Copy After:=Sheets(2)
End Sub


Sub Delete_with_Autofilter()
Dim DeleteValue As String
Dim rng As Range

DeleteValue = ""
' This will delete the rows with "" in the Range("A1:A500")
With ActiveSheet
.Range("A1:A500").AutoFilter Field:=1, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete

End With
.AutoFilterMode = False
End With
End Sub

Again, what I like to do: copy a sheet, then delete-autofilter.

Thanks Don

"Don Guillett" wrote:

It's probably as simple as just putting the name of the second macro as the
last line in the first.

sub ddd
do this
do that
end sub

--
Don Guillett
SalesAid Software

"bioyyy" wrote in message
...
Hi,

How do I combine 2 macro that they can do at a same time? Right now, I

have
one macro doing "copy a sheet" and then another macro doing
"delete-autofilter". I'd like to combine them together, so I don't have to
execute 2 times. In other words, right after copy a sheet, it does deleted
things. thanks