Thread: Lookup
View Single Post
  #2  
Old 11-11-2009, 03:52 PM
JP Romano's Avatar
JP Romano JP Romano is offline
Forum Contributor
 
Join Date: 09 Oct 2008
Location: Princeton, NJ
MS Office Version:2007 at work. Abacus at home
Posts: 169
JP Romano has been very helpful
Re: Lookup Formula Help - Possible VBA?

Not elegant, but it works for me...

This assumes your data starts in A2 and will put your results in columns F-H.

Code:
Dim lastrow As Integer
lastrow = Range("a65536").End(xlUp).Row

Range("A2").Select
Do Until ActiveCell.Row = lastrow
    If ActiveCell.Value = "PayPal" Then
        Row = ActiveCell.Row
        Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 3)).Copy
        Range("G65536").End(xlUp).Offset(1, 0).Select
        ActiveCell.Offset(0, -1).Value = "PayPal"
        ActiveCell.PasteSpecial
        Range("A" & Row).Select

    End If
    ActiveCell.Offset(1, 0).Select
    Loop

Range("F2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
       .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
    End With
    Range("F2").Select
Let me know if that's what you're after!
__________________
Who believes in telekinesis... raise my hand!

Last edited by JP Romano; 11-11-2009 at 03:59 PM.
Reply With Quote