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
Bookmarks