Hello,
I have a sheet (sheet1) with products (row B) and one with prices (C).
Next i have a userform (UserForm1) with all the products and a listbox (ListBox1).
When i'm clicking on a commandbutton then i want to see my product and price near each other.
This is my code that i have so far...
Private Sub CommandButton6_Click()
Dim cell As Range
Dim rng As Range
ListBox1.ColumnCount = 2
With ThisWorkbook.Sheets("Sheet1")
Set rng = .Range("B7:C7")
End With
For Each cell In rng.Cells
With Me.ListBox1
.AddItem cell.Value
ListBox1.Column(0, ListBox1.ListCount - 1) = cell.Value
ListBox1.Column(1, ListBox1.ListCount - 1) = cell.Value
End With
Next cell
End Sub
See image for my userform
I have a sheet (sheet1) with products (row B) and one with prices (C).
Next i have a userform (UserForm1) with all the products and a listbox (ListBox1).
When i'm clicking on a commandbutton then i want to see my product and price near each other.
This is my code that i have so far...
Private Sub CommandButton6_Click()
Dim cell As Range
Dim rng As Range
ListBox1.ColumnCount = 2
With ThisWorkbook.Sheets("Sheet1")
Set rng = .Range("B7:C7")
End With
For Each cell In rng.Cells
With Me.ListBox1
.AddItem cell.Value
ListBox1.Column(0, ListBox1.ListCount - 1) = cell.Value
ListBox1.Column(1, ListBox1.ListCount - 1) = cell.Value
End With
Next cell
End Sub
See image for my userform