Hi,
First you have to change the name of your second macro to be different than
the name of the first macro.
For example Sub DeleteColumns() and Sub DeleteColumns_2()
Then copy this code:
Sub Run_both_macros()
' Macro recorded 7/24/2007 by Tim
DeleteColumns
DeleteColumns_2
End Sub
Go to your workbookhit Alt+F11Double click a module and paste my
codeclose
VB EditorAlt+F8 and run macro: Run_both_macros
Regards,
Tim
"saman110 via OfficeKB.com" wrote:
How do you guys put or run two macros together in one macro. I have to
separate macros that i want to run one after each other in one macro.
Sub DeleteColumns()
Dim i As Integer
For i = 256 To 1 Step -1
If Cells(1, i).Text = "Rank" Or _
Cells(1, i).Text = "Housing units" Or _
Cells(1, i).Text = "Occupied Housing Units" Or _
Cells(1, i).Text = "Vacant Housing Units" Then
Cells(1, i).EntireColumn.Delete
End If
Next i
End Sub
----------------------and
Sub DeleteColumns()
Dim i As Integer
For i = 256 To 1 Step -1
If Cells(2, i).Text = "Subtotal of High" Or _
Cells(2, i).Text = "Subtotal of Extremely High" Or _
Cells(2, i).Text = "Subtotal of Average" Or _
Cells(2, i).Text = "Subtotal of Below Average" Or _
Cells(2, i).Text = "Subtotal of Above Average" Or _
Cells(2, i).Text = "Grand Total" Then
Cells(2, i).EntireRow.Delete
End If
Next i
End Sub
--
Message posted via http://www.officekb.com