How to generate a table in excel

Closed
Paul - Sep 22, 2011 at 08:30 AM
 hytr - Oct 4, 2011 at 11:16 AM
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 replies

TrowaD
Posts
2888
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
August 16, 2022
515
Sep 22, 2011 at 09:55 AM
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
0
jgh
0