In the following code before the Private Sub Routine(RunItClose) goes to the next CdItem, I would like to run another Private Sub Routine called (RunItSingleStockClose). After RunItSingleStock close has run and returns to RunItClose the macro does not go to the next CdItem. Can someone please help me with this? Thanks in advance
Private Sub RunItClose()
Dim Cnt As Long
Set CodeRNG = Range("G2", Range("G20").End(xlUp))
For Each CdItem In CodeRNG
If (CdItem.Value > 0) Then
GetReportClose (CdItem.Value)
Range("A27:D56").Copy
Cells(27, 16 + (Cnt * 15)).PasteSpecial xlPasteValues
Cnt = Cnt + 1
RunItSingleStockClose
Cleanup
End If
Next CdItem
Set CodeRNG = Nothing
Range("A1").Activate
End Sub
Private Sub GetReportClose(Code As Integer)
'First line
Dim i As Long, LR As Long
i = 446
Range("D60:E60").AutoFilter
Range("D60:E60").AutoFilter Field:=1, Criteria1:="=" & CdItem.Offset(0, 1)
Range("D60:E60").AutoFilter Field:=2, Criteria1:="=" & CdItem.Offset(0, 2)
LR = Range("D135").End(xlUp).Row
If LR > 60 Then
Range("A61:A" & LR).EntireRow.Copy
Range("A446").PasteSpecial xlPasteValues
End If
ActiveSheet.AutoFilterMode = False
Application.CutCopyMode = False
Private Sub RunItSingleStockClose()
Dim Cnt As Long
Set CodeRNG = Range("G2", Range("G20").End(xlUp))
For Each CdItem In CodeRNG
If (CdItem.Value > 0) Then
GetReportSingleStockClose (CdItem.Value)
Range("G27:H56").Copy
Cells(27, 22 + (Cnt * 15)).PasteSpecial xlPasteValues
Cnt = Cnt + 1
Cleanup
RunItClose
End If
Next CdItem
Set CodeRNG = Nothing
Range("A1").Activate
End Sub
Private Sub GetReportSingleStockClose(Code As Integer)
'First line
Dim i As Long, LR As Long
i = 510
Range("D214:E214").AutoFilter
Range("D214:E214").AutoFilter Field:=1, Criteria1:="=" & CdItem.Offset(0, 1)
Range("D214:E214").AutoFilter Field:=2, Criteria1:="=" & CdItem.Offset(0, 2)
LR = Range("D289").End(xlUp).Row
If LR > 214 Then
Range("A215:A" & LR).EntireRow.Copy
Range("A510").PasteSpecial xlPasteValues
End If
ActiveSheet.AutoFilterMode = False
Application.CutCopyMode = False
End Sub
Bookmarks