View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Macro to filter two columns

Hi

Try this:

Sub bbb()
FirstRow = 2 'Headings in row 1
LastRow = Range("B" & Rows.Count).End(xlUp).Row

For r = FirstRow To LastRow
If Cells(r, 1) = "" Then
LastCol = Range("A" & TargetRow).End(xlToRight).Column
Cells(r, 2).Resize(1, 4).Cut Destination:=Cells(TargetRow,
LastCol + 1)
Else
TargetRow = r
End If
Next
Range("A1", Cells(TargetRow, 1)).SpecialCells
(xlCellTypeBlanks).EntireRow.Delete
End Sub

Regards,
Per

On 7 Maj, 03:05, Polo78 Lacoste wrote:
I have another dilemma, hope you help me out on this one. Original data
has 4 columns, driven by column A. This is somewhat a transpose but on
multiple columns.

Before macro run

Column A * *column B Column C Column D *Column E
Client 1 * *item * * qty * * *date1 * * date2
<blank * * item2 * *qty * * *date1 * * * date2
<blank * * item3 * *qty * * *date1 * * * date2
Client 2 * *item * * qty * * *date1 * * date2
<blank * * item2 * *qty * * *date1 * * * date2 *
Client 3 * *item * * qty * * *date1 * * date2 *
<blank * * item2 * *qty * * *date1 * * * date2
<blank * * item3 * *qty * * *date1 * * * date2
<blank * * item4 * *qty * * *date1 * * * date2

After macro run

Column A * Column F
Client 1 * item-qty-date; item2-qty-date2; item3-qty-date2
Client 2 * item-qty-date; item2-qty-date2; *
Client 3 * item-qty-date; item2-qty-date2; item3-qty-date2;
item4-qty-date2

After the macro is finished, any blank data in column A should be
deleted. Also Column F should be appended to Column A-E (totalling 6
columns when report is done).

Need VBA macro coding to help out and get started.

Thank you in advance.

Newbie to VBA.

*** Sent via Developersdexhttp://www.developersdex.com***