kanishkgarg
New Member
- Joined
- Sep 29, 2021
- Messages
- 21
- Office Version
- 365
- Platform
- Windows
I have a table full of data. What I need to do is the following:
The following is a sample of the data I have in the first sheet (s1):
I am able to only do the following uptil now:
- Filter and copy all unique values in one specific column from one sheet (s1) to another(s2). (I have done this)
- Filter each unique value and sum up corresponding data in another column.
- Filter each unique value and sum the products of data in two corresponding columns(col2 and col3).
The following is a sample of the data I have in the first sheet (s1):
Account | Col2 | Col3 |
---|---|---|
A | 2 | 4 |
A | 3 | 5 |
B | 2 | 6 |
B | 3 | 4 |
B | 2 | 2 |
C | 3 | 3 |
C | 2 | 4 |
I am able to only do the following uptil now:
VBA Code:
Sub CopyUnique()
Dim s1 As Worksheet, s2 As Worksheet
Dim tempLast As Long
Dim lr As Long
Set s1 = Sheets("Bericht1")
Set s2 = Sheets("Sheet1")
s1.Range("E:E").Copy s2.Range("c1")
s2.Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
tempLast = s2.Cells(Rows.Count, "A").End(xlUp).Row
End Sub