I'm able to display the data I take out from db worksheet as rows correctly. But I'm unable to display it as columns correctly...what is wrong?
Private Sub CommandButton1_Click()
Dim intRow As Integer
Dim custIDchosen As String
intRow = 2
Do While Worksheets("db").Cells(intRow, 2).Value <> ""
If CStr(Worksheets("db").Cells(intRow, 1).Value) = Sheets("nvT").Range("b1").Value Then
cusID = Worksheets("db").Cells(intRow, 5).Value
cus = Worksheets("db").Cells(intRow, 4).Value
Sheets("nvT").Range("a" & Rows.Count).End(xlUp)(2).Resize(, 2).Value = _
Array(cusID, cus)
proID = Worksheets("db").Cells(intRow, 7).Value
pro = Worksheets("db").Cells(intRow, 8).Value
Worksheets("Sheet1").Range("b1", Worksheets("Sheet1").Cells(1, Columns.Count).End(xlToLeft))(3).Value = _
Array(proID)
End If
intRow = intRow + 1
Loop
End Sub
Bookmarks