I have a user form which has a number of buttons on it. Each button represents a vegetable (Eg, Cucumber, Carrot, Tomato)
The purpose of this is to take orders from customers for the vegetable they would like to order and the amount.
When each button is clicked (eg, Carrot) the macro would place the word 'Carrot' on the excel sheet. After which an input box will appear for the user to input the amount needed.
The problem i have is, i want to collate this data but i cannot set the cell to place the word 'Carrot' as it might not be the first thing the user orders.
I need a code that collates these data in any order that the user orders.
This is the code for a button that i currently use (But it only runs to two line before it overwrites itself) :
I need the list to collate.
If there is a better way to do this, i would greatly appreciate it too.
The purpose of this is to take orders from customers for the vegetable they would like to order and the amount.
When each button is clicked (eg, Carrot) the macro would place the word 'Carrot' on the excel sheet. After which an input box will appear for the user to input the amount needed.
The problem i have is, i want to collate this data but i cannot set the cell to place the word 'Carrot' as it might not be the first thing the user orders.
I need a code that collates these data in any order that the user orders.
This is the code for a button that i currently use (But it only runs to two line before it overwrites itself) :
Code:
Private Sub Carrot_Click() a = 6 ' Do If Cells(a, 3) = 0 Then Cells(a, 3).Value = "Carrot" Else a = a + 1 Cells(a, 3).Value = "Carrot" End If ' Loop Until Cells(a, 4) = 0 ' Range("C6").Select Dim foodAmt As String foodAmt = InputBox(Prompt:="Please State Amount", _ Title:="Please Enter Amount", Default:="Enter Amount Here") If foodAmt = "Customer Name Here" Or _ foodAmt = vbNullString Then Exit Sub Else a = 6 If Cells(a, 4) = 0 Then Cells(a, 4).Value = foodAmt Else a = a + 1 Cells(a, 4).Value = foodAmt End If End If End Sub
If there is a better way to do this, i would greatly appreciate it too.
Comment