How to generate a table in excel

Closed
Paul - 22 Sep 2011 à 08:30
 hytr - 4 Oct 2011 à 11:16
Hello,

will be very pleased if someone could help me on the following. I have a dataset on sheet1 consisting of 40 columns and let's say 500 rows.

I need to
1. extract data out from there satysfying two conditions: date (column A) => 01/08/2011 and product (column B = "soap");
2. generate new table from data extract from 1) above at the summary sheet (sheet3), consisting only from 4 columns - A,C,D,E and rows depeding on the quantity in extract.
This table should be generated in a certain location, let's say starting from 10th row in D-G column diapason.

Any thoughts on the task..?


2 responses

TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 555
22 Sep 2011 à 09:55
Hi Paul,

Try this code:
Sub test()
Dim MR
Dim x As Integer
Set MR = Range("A1:A20")
x = 10
For Each cell In MR
If cell.Value >= 40756 And cell.Offset(0, 1).Value = "Soap" Then
cell.Copy Sheets("Sheet3").Range("D" & x)
Range(cell.Offset(0, 2), cell.Offset(0, 4)).Copy Sheets("Sheet3").Range("E" & x)
x = x + 1
End If
Next
End Sub

Is this what you were looking for?

Best regards,
Trowa