Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Putting macros together
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Putting macros together
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 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Putting macros together
When in VB Editor instead double click a module got to InsertNew Module and
then Paste Tim |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Putting macros together
Thank you for your response.
What if you have 3 macros to run? Tim wrote: 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 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. [quoted text clipped - 28 lines] Next i End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200707/1 |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Putting macros together
Same thing for 30
-- Don Guillett Microsoft MVP Excel SalesAid Software "saman110 via OfficeKB.com" <u35670@uwe wrote in message news:75aa1a4037724@uwe... Thank you for your response. What if you have 3 macros to run? Tim wrote: 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 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. [quoted text clipped - 28 lines] Next i End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200707/1 |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Putting macros together
Nevermind I got it.
thx saman110 wrote: Thank you for your response. What if you have 3 macros to run? Hi, [quoted text clipped - 21 lines] Next i End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200707/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
putting symbols | Excel Discussion (Misc queries) | |||
Putting many columns into one | Excel Discussion (Misc queries) | |||
Putting macros on a toolbar | Excel Discussion (Misc queries) | |||
putting jpg files into csv? | Excel Discussion (Misc queries) | |||
putting in a sum finction | Excel Discussion (Misc queries) |