PDA

View Full Version : macro calling another macro



jaango123
11-26-2010, 04:47 AM
Hi all,

please help me with the below two queries
1)How to find programmatically, no of rows which is not blank. Can I useUsedrange.rows.count. If so do you have any examples.
2) I have three macros. macro1,macro2,macro3
Can anyone help me in writting another macro which will
1)execute macro1
2)Sort the data in sheet1 according to column H
3)Remove all the rows which has column H blank
4)execute macro2
5)sort by column T largest to smallest
6)remove all the rows which is having Column T below 14
7)Sort by Column A add one more level and sort by column G
8)execute macro 3

Any help is appreciated

dragon
11-26-2010, 05:15 AM
For 1) try:

Dim LastRow As Integer
LastRow = ActiveSheet.UsedRange.Rows.Count

Bob Phillips
11-26-2010, 05:40 AM
UsedRange.Rows.Count will count any embedded blank rows.

shrivallabha
11-27-2010, 09:43 PM
You can have all of the above macros in one module and call them in sequence #2 To #8.

Sub MyMac1()
'End of MyMac1 Code
Call MyMac2
End Sub

Sub MyMac2()
'MyMac2 Code
End Sub

Norie
11-28-2010, 11:13 AM
For 1) you could use Application.CountBlank, and probably various other methods.

For the whole thing it might be interesting to know what the overall goal is.

The steps you descrine aren't exactly identical but they do seem to follow some sort of pattern sort, filter/delete, sort...

Perhaps it could all be done with one sub?:)