Results 1 to 6 of 6

Button for adding a new line across multiple sheets, inputting data to certain cells

Threaded View

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    29

    Question Button for adding a new line across multiple sheets, inputting data to certain cells

    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!
    Last edited by alansidman; 02-05-2014 at 08:50 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 01-20-2009, 11:56 AM
  2. adding cells from multiple sheets
    By macafeller in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2007, 09:53 PM
  3. inputting multiple data with different formats into the same cells
    By Tintin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2007, 12:12 PM
  4. Adding a line over multiple sheets
    By c991257 in forum Excel General
    Replies: 1
    Last Post: 02-28-2007, 07:52 PM
  5. Adding Cells from Multiple Sheets
    By Kevin G in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2005, 02:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1