+ Reply to Thread
Results 1 to 3 of 3

Running Several Macros One after another

Hybrid View

  1. #1
    Registered User
    Join Date
    07-31-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    21

    Running Several Macros One after another

    Hey all,

    So I have created a macro, that runs a series of other macros. Please see here the code:

    Sub RunDividendUpdate()
        Dim Msg As String
        Sheets("Dividends").Select
        If Range("DateToday") = Range("DateDividendsLastRan") Then
                                                              Sheets("Portfolio Management Screen").Select
                                                              MsgBox "The Dividend Procedure has already run today"
        ElseIf Range("DateToday") <> Range("DateDividendsLastRan") Then
                                                              LoadDividendData
                                                              LeaveOnlyExDividendStocks
                                                              CalculateDividend
                                                              SumDividendtoTotal
                                                              TimeStampDividendsProcedure
                                                              UpdateDividendData
                                                             
        End If
    End Sub
    When I run this macro by pressing F5 the sequence stops before the TimeStampDividendsProcedure. It just stops. No error message. I then press F5 again and the TimeStampDividendsProcedure and UpdateDividendData run correctly.

    The only indication I have is the End Sub part of SumDividendtoTotal is highlighted a burgundy red colour.

    I have placed the code below for the SumDividendtoTotal and TimeStampDividendsProcedure.

    Sub SumDividendtoTotal()
        Dim Cell As Range
        Range("DividendTickers").Select
        For Each Cell In Selection
            If Len(Cell.Value) >= 1 Then
                                    Range("TotalDividendReceived").Copy
                                    Cell.Offset(0, 6).Range("A1").Select
                                    ActiveSheet.Paste
                                    Application.CutCopyMode = False
        End If
        Next Cell
    End Sub
    Sub TimeStampDividendsProcedure()
         With Range("DateDividendsLastRan")
        .Value = Date
        .NumberFormat = "dd/mm/yyyy"
        End With
    End Sub
    As I have had no error message this has been difficult to de-bug. Hence why I post for help

    Thanks

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Running Several Macros One after another

    You're not getting an error here:

    Cell.Offset(0, 6).Range("A1").Select
    What are you trying to do with this line?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    07-31-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Running Several Macros One after another

    Quote Originally Posted by XeRo Solus View Post
    You're not getting an error here:

    Cell.Offset(0, 6).Range("A1").Select
    What are you trying to do with this line?
    This is to copy a formula down which adds to cells together in the row.

    I just had another look through all the macros following your comment and it all seemed fine. I ran again the 'run all macro' and it works. I really dont understand as it was definitely not working earlier.

    Thanks very much for your reply, and sorry if i wasted your and anyone elses time

    Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Running XLM macros
    By srwpchelp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2011, 09:37 AM
  2. Running Two Macros
    By dineshsilicon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2011, 10:31 PM
  3. Running Macros
    By Scooternm in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2008, 04:07 PM
  4. Running Macros from my Add-in
    By Neil07979 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2008, 09:17 AM
  5. [SOLVED] Running Macros
    By in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-06-2006, 10:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1