View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Macro to filter two columns

Try this version:

Sub bbb2()
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
myVal = ""
myVal = Cells(r, 2).Text
For i = 1 To 3
myVal = myVal & "-" & Cells(r, 2 + i).Text
Next i
Cells(TargetRow, LastCol + 1).Value = myVal
Else
TargetRow = r
End If
Next
Range("A1", Cells(TargetRow, 1)).SpecialCells(xlCellTypeBlanks).EntireRow.Delet e
End Sub



HTH,
Bernie
MS Excel MVP


"Polo78 Lacoste" wrote in message
...
I forgot to mention that all the columns on F and after, should all be
in one cell, so when there is a vlookup on a column A, column F has all
the data. Im trying to figure out how to concat the cells data. You did
an excellent job by the way.

Thank you in advance.

Newbie to VBA.

*** Sent via Developersdex http://www.developersdex.com ***