Hey Everyone,
Here's my situation. I have a liquor accounting and ordering system I'm introducing for a small chain of restaurants and bars, and there are many different products across them all. To implement this system, one hurdle we are looking into is an easy way for a certain location to add a new product into their inventory.
The system is a 4 page worksheet, and what I'd like is to be able to push a button and have a dialog box pop where they could fill in the information needed to add a product. They would select a row in the section they want to add a product, fill in some info about the product, and it would insert that data into a couple different cells across the workbook, always on the same row.
This is what I have so far, I copy and pasted something from someone else who was doing something similar and tweaked it, but I'm not sure how to paste different information into different cells on the different sheets. It is also copying any information that doesn't have something to input from the line above it.
Sub Addline()
Dim Response As String, NewName As String
Dim ws As Worksheet
Response = MsgBox("Have you selected the Yellow row in the category where you want to insert the product?", vbYesNo)
If Response = vbNo Then Exit Sub
NewName = InputBox("Product name")
If NewName = vbNullString Then
MsgBox "Sorry I didn't get that, re-try from start"
Exit Sub
End If
CSPC = InputBox("CSPC")
If NewName = vbNullString Then
MsgBox "Sorry I didn't get that, re-try from start"
Exit Sub
End If
PackSize = InputBox("What is the packsize? (# of OZ or Bottles)")
If NewName = vbNullString Then
MsgBox "Sorry I didn't get that, re-try from start"
Exit Sub
End If
BtlCanOZ = InputBox("Enter Btl, Can or OZ")
If NewName = vbNullString Then
MsgBox "Sorry I didn't get that, re-try from start"
Exit Sub
End If
Price = InputBox("Price per unit?")
If NewName = vbNullString Then
MsgBox "Sorry I didn't get that, re-try from start"
Exit Sub
End If
r = ActiveCell.Row
'note these must be the names of the sheets as they appear
'on the worksheet tab
For Each ws In Sheets(Array("Inventory sheet", "Order par sheet", "Order"))
With ws
.Rows(r).EntireRow.Insert
.Cells(r, 1) = NewName
.Cells(r, 2) = PackSize
.Cells(r, 3) = BtlCanOZ
.Cells(r - 1, 2).Resize(2, 256).FillDown
End With
Next
End Sub
So an example of where I would want the data to go would be something like in the first page, the order would be Cell 1 NewName, Cell 2 Packsize, Cell 3 BtlCanOz. Then on the worksheet labelled "order par sheet" I would need the same row to have Cell 1 NewName, Cell 2 Packsize. On Worksheet labelled Order, I need Cell 1 CSPC, Cell 2 NewName
Thanks Everyone, any help is really appreciated!
Bookmarks