Hey there everyone,
I've been trying to wrap my head around this for a while now.
I'm trying to build a simple data entry form for drinks recipes, one which I can edit as I want.
I have a Listbox on a userform which I've coded to show the names of the drinks and then populate various textboxes and comboboxes.
What I cannot figure out is how I can then edit those values and save to the worksheet or delete the entire entry from the worksheet.
"DrName" is a dynamic range on the worksheet.
The above is the code for viewing the list box. I have two command buttons called "Save" and "Delete" waiting to be used for their respective purposes. How can I go from viewing those values to overwriting them? Or to deleting them?
This is my first time posting, so I apologise for any breaches of etiquette. Unfortunately I cannot install XL2BB on this computer so. Any help will be greatly appreciated.
I've been trying to wrap my head around this for a while now.
I'm trying to build a simple data entry form for drinks recipes, one which I can edit as I want.
I have a Listbox on a userform which I've coded to show the names of the drinks and then populate various textboxes and comboboxes.
What I cannot figure out is how I can then edit those values and save to the worksheet or delete the entire entry from the worksheet.
VBA Code:
Private Sub ListBoxViewCocktails_Click()
With Me
.TextViewCockSize1 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 6, False)
.ComboViewCockMeas1 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 7, False)
.TextViewCockIngred1 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 5, False)
.TextViewCockSize2 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 10, False)
.ComboViewCockMeas2 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 11, False)
.TextViewCockIngred2 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 9, False)
.TextViewCockSize3 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 14, False)
.ComboViewCockMeas3 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 15, False)
.TextViewCockIngred3 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 13, False)
.TextViewCockSize4 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 18, False)
.ComboViewCockMeas4 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 19, False)
.TextViewCockIngred4 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 17, False)
.TextViewCockSize5 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 22, False)
.ComboViewCockMeas5 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 23, False)
.TextViewCockIngred5 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 21, False)
.TextViewCockSize6 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 26, False)
.ComboViewCockMeas6 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 27, False)
.TextViewCockIngred6 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 25, False)
.TextViewCockSize7 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 30, False)
.ComboViewCockMeas7 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 31, False)
.TextViewCockIngred7 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 29, False)
.TextViewCockSize8 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 34, False)
.ComboViewCockMeas8 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 35, False)
.TextViewCockIngred8 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 33, False)
.TextViewCockSize9 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 38, False)
.ComboViewCockMeas9 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 39, False)
.TextViewCockIngred9 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 37, False)
.TextViewCockSize10 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 42, False)
.ComboViewCockMeas10 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 43, False)
.TextViewCockIngred10 = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 41, False)
.ComboViewCockGlassware = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 45, False)
.ComboViewCockMethod = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 46, False)
.TextViewCockMethod = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 47, False)
.TextViewCockName = Application.WorksheetFunction.VLookup(Me.ListBoxViewCocktails, Sheet2.Range("DrName"), 1, False)
End With
End Sub
"DrName" is a dynamic range on the worksheet.
The above is the code for viewing the list box. I have two command buttons called "Save" and "Delete" waiting to be used for their respective purposes. How can I go from viewing those values to overwriting them? Or to deleting them?
This is my first time posting, so I apologise for any breaches of etiquette. Unfortunately I cannot install XL2BB on this computer so. Any help will be greatly appreciated.