Hi Everyone,
I am slowly making a new sheet that includes:
- A cascading dropdown list done with the help of Dflak here, the cascading dropdown is where I choose the buyer and seller as parent and trader is the person whom I talked to, one company can have multiple traders. (working)
- A VBA macro to e-mail PDF through mac Mail, where it will automatically send PDF to my team and also to the buyer (working)
- A VBA macro to copy the data (Date, Contract Nr.*, Buyer, Seller, Quality, Price, Volume* and Shipment*)
Where I am stuck now is on copying the data on the Bold items with *
We most of the times make sales that are spread throughout different months, and volume can be changed too, so I have:- Last Contract number is on cell N5
- New contract numbers are on range (K18:K31)
- Volume range(F18:F31)
- Shipment months range(B18:B31)
Let's say for instance I am on contract number 10, and I make a new contract that goes from January through March (3 months) and each months has 300 bags. (ranges with data are only 3 columns deep out of 14)
I have gotten this VBA to copy the data, but how can I make it copy only if there is data, and also include items which not as a range?
Dim ms As Worksheet, NR
Set ms = Sheets("historico")
With Sheets("Sale")
NR = ms.Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
If ms.Range("B" & NR - 1) = (Range("K3").Value) Then
NR = ms.Cells.Find("*", , , , xlByRows, xlPrevious).Row
End If
ms.Range("A" & NR) = Date
.Range("K18").Resize(3).Copy
ms.Range("B" & NR).PasteSpecial xlValues, Transpose:=True
.Range("D5").Copy
ms.Range("C" & NR).PasteSpecial xlValues, Transpose:=True
.Range("K5").Copy
ms.Range("D" & NR).PasteSpecial xlValues, Transpose:=True
.Range("D13").Copy
ms.Range("E" & NR).PasteSpecial xlValues, Transpose:=True
.Range("D16").Copy
ms.Range("F" & NR).PasteSpecial xlValues, Transpose:=True
.Range("D14").Copy
ms.Range("G" & NR).PasteSpecial xlValues, Transpose:=True
.Range("D12").Copy
ms.Range("H" & NR).PasteSpecial xlValues, Transpose:=True
Application.CutCopyMode = False
End With
Attached the full sheet in case it helps you help me :D
Thanks in advance
Bookmarks