Good afternoon,
I'm trying to make a very complex VBA code in excel but so far it is not working as it should.
Information:
In excel I get a list wich is containing over 300 rows of information on 1 sheet with each different statements. (Used for weight calculation)
Each statements consists of 3 rows, with on the first row in column D/E(combined cells) style 1, Column G style and on the second row the quantity in column S/T/U(Combined cells).
imageshack.us/photo/my-images/843/excelsample1.jpg/
The styles vary between 20 styles but for this style A and B is enough.
imageshack.us/photo/my-images/833/excelsample2.jpg/
What I need is a VBA code that Finds on Column D/E all the rows that are Style A and than looks at column G for style C.
Then It should Copy all results with in column D/E style A and Column Style C to sheet 1, with in the copy both styles and quantity.
For 2nd It should find Style A and in column G style D and copy both styles and quantity to sheet 2.
Etc. When I have the code for 1 it's easy to do the others.
I have now this code but with it I can only copy style 1 but I need to copy Style 2 and the quantity to.
Hope you guys understand what I mean and thanks in advance for your help.
I'm trying to make a very complex VBA code in excel but so far it is not working as it should.
Information:
In excel I get a list wich is containing over 300 rows of information on 1 sheet with each different statements. (Used for weight calculation)
Each statements consists of 3 rows, with on the first row in column D/E(combined cells) style 1, Column G style and on the second row the quantity in column S/T/U(Combined cells).
imageshack.us/photo/my-images/843/excelsample1.jpg/
The styles vary between 20 styles but for this style A and B is enough.
imageshack.us/photo/my-images/833/excelsample2.jpg/
What I need is a VBA code that Finds on Column D/E all the rows that are Style A and than looks at column G for style C.
Then It should Copy all results with in column D/E style A and Column Style C to sheet 1, with in the copy both styles and quantity.
For 2nd It should find Style A and in column G style D and copy both styles and quantity to sheet 2.
Etc. When I have the code for 1 it's easy to do the others.
I have now this code but with it I can only copy style 1 but I need to copy Style 2 and the quantity to.
Code:
Private Sub Copy_To_Another_Sheet_1()
Dim FirstAddress As String
Dim MyArr As Variant
Dim Rng As Range
Dim Rcount As Long
Dim I As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
MyArr = Array("A")
With Sheets("Sheet1").Range("D1:E30")
Rcount = 0
For I = LBound(MyArr) To UBound(MyArr)
Set Rng = .Find(What:=MyArr(I), _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
FirstAddress = Rng.Address
Do
Rcount = Rcount + 1
Rng.Copy Worksheets(Sheet2).Range("A" & Rcount)
Set Rng = .FindNext(Rng)
Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
End If
Next I
End With
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Hope you guys understand what I mean and thanks in advance for your help.