I'm trying to run through a list of customer accounts. If there have been 0 transactions for a set period of time, I want a particular message displayed. If there have been some transactions, then I want to copy and paste details from a data file, onto their document template. The issue that I'm finding is only copying the visible data from the filter, onto the template. I've googled copying filtered cells onto another worksheet, and I haven't seen anything that explains what I'm trying to do.
Example, if I filter, and the data I'm trying to copy starts in row 7 and runs through row 15, I would want to copy C7:C15, and paste it into A60 on the template.
Example, if I filter, and the data I'm trying to copy starts in row 7 and runs through row 15, I would want to copy C7:C15, and paste it into A60 on the template.
VBA Code:
For Each c In Rng
If c <> "" Then
c.Copy
sMS1.Range("K7").PasteSpecial xlPasteValues
If sMS1.Range("G58").Value < 1 Then
sMS1.Range("A60").Value = "No transaction activity for this statement period."
fName = sMS1.Range("K7").Value & ".xlsx"
s.SaveAs fPath & fName
'Next
Else
'If sMS1.Range("G58").Value > 0 Then
mTH.UsedRange.AutoFilter field:=1, Criteria1:=sMS1.Range("K7").Value
mTH.Range("C2" & mTHLR).SpecialCells(xlCellTypeVisible).Copy
sMS1.Range("A60").PasteSpecial xlPasteValues
mTH.Range("D2" & mTHLR).SpecialCells(xlCellTypeVisible).Copy
sMS1.Range("D60").PasteSpecial xlPasteValues
mTH.Range("E2" & mTHLR).SpecialCells(xlCellTypeVisible).Copy
sMS1.Range("J60").PasteSpecial xlPasteValues
End If
fName = sMS1.Range("K7").Value & ".xlsx"
s.SaveAs fPath & fName
End If
Next