TheRedCardinal
Board Regular
- Joined
- Jul 11, 2019
- Messages
- 243
- Office Version
- 365
- 2021
- Platform
- Windows
I've tried to solve this myself but I've now hit a brick wall.
I have a table of data with 12 columns and multiple rows that vary.
I want to split that table out into two workbooks depending on the value of the content of column 5 - which will either be "Payable or Receivable"
I then want to condense all lines which have the same reference in column 2 into a single line, maintaining all the other data (which is text and so identical) except the values in columns 7 8 and 9 which I need to sum up.
I've attempted a summary here (I've removed some columns for the sake of the visual)
I started with this, which was to create a dictionary containing unique values.
This worked well and I have 2 dictionaries containing unique values.
But now I am not sure where to go....?
I have a table of data with 12 columns and multiple rows that vary.
I want to split that table out into two workbooks depending on the value of the content of column 5 - which will either be "Payable or Receivable"
I then want to condense all lines which have the same reference in column 2 into a single line, maintaining all the other data (which is text and so identical) except the values in columns 7 8 and 9 which I need to sum up.
I've attempted a summary here (I've removed some columns for the sake of the visual)
I started with this, which was to create a dictionary containing unique values.
VBA Code:
Set SalesObjDict = CreateObject("Scripting.Dictionary")
Set PurchObjDict = CreateObject("Scripting.Dictionary")
Set Wbk1 = ThisWorkbook
Set WS1 = Wbk1.Sheets("Results")
ResultsArray = WS1.Range("Data")
For Counter = 2 To UBound(ResultsArray)
If ResultsArray(Counter, 5) = "VAT payable" Then
SalesObjDict(ResultsArray(Counter, 2)) = 1
Else
PurchObjDict(ResultsArray(Counter, 2)) = 1
End If
Next Counter
End Sub
This worked well and I have 2 dictionaries containing unique values.
But now I am not sure where to go....?