Banner

Thursday, February 23, 2017

Filter Database With Customer Name In Worksheet Excell VBA





Private Sub ComboBox1_Change()

Dim i As Long

Sheet1.Range("A2:F1000").ClearContents

For i = 2 To Application.WorksheetFunction.CountA(Sheet2.Range("A:A"))

c = Application.WorksheetFunction.CountA(Sheet1.Range("A:A")) + 1

For x = 1 To 6

If Sheet2.Cells(i, 1).Value = Me.ComboBox1.Value Then

Sheet1.Range("A" & c).End(xlToLeft).Offset(0, x - 1).Value = Sheet2.Cells(i, x).Value

End If

Next x

Next i

Sheet1.Range("G2").Value = Application.WorksheetFunction.Sum(Sheet1.Range("F:F"))

End Sub

No comments:

Post a Comment

Please do not enter any spam message in comment box