+ Reply to Thread
Results 1 to 5 of 5

Shopping list macro help

Hybrid View

  1. #1
    Registered User
    Join Date
    01-22-2018
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Shopping list macro help

    Hi everyone!

    I'm fairly new to macros and VBA - so please excuse any stupid questions - but I'm hoping you can help me out.

    I'm trying to create a macro which will add selected items to a shopping list. When I click the "+" icon next to the item I want that item to be added to the shopping list on a different sheet, on the line below whatever has previously been added.

    On the attached document please see the first and second sheets which demonstrate what I'm trying to do.

    If what I am asking for is an easy task for you, and you wantsomething a little more challenging to get stuck into I have also added sheets 3 and 4, which show how I would have the sheet running in a perfect world. The add symbol would open up a pop-up which would allow me to enter in the quantity and units required. Pressing the "Add" button would transfer all of this data into the shopping list.

    I don't know if this is something which is possible, and I would be very happy if it only worked as I suggested in the more simple format, but if you could manage to create the pop-up that would be amazing.

    Thank you for your time, it is greatly appreciated and I hope you are able to help.

    Many thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Shopping list macro help

    Why So complicated?

    Type the quantity in column B Entering Return could copy that line to the shopping list, but is pointless.

    Once you have entered your quantities click on a button to create the shopping list..... Much Better

    This Macro would do what you need, Just assign it to a button.

    Sub Macro1()
        Sheets("Shopping List").Cells.ClearContents
        Columns("C:C").SpecialCells(xlCellTypeConstants, 1).Select
        Selection.EntireRow.Copy Destination:=Sheets("Shopping List").Range("A1")
    End Sub

    Better Still Assign it to a worksheet activation Macro
    
    Private Sub Worksheet_Activate()
    Sheets("All Items").Select
    Macro1
    
    End Sub


    This Code is modified to clear the shopping list automatically

    
    Sub Macro1()
        Sheets("Shopping List").Cells.ClearContents
        Columns("C:C").SpecialCells(xlCellTypeConstants, 1).Select
        Selection.EntireRow.Copy Destination:=Sheets("Shopping List").Range("A1")
        LR = Cells(Rows.Count, 3).End(xlUp).Row
        Range("C2:C" & LR).Clear
        Range("A1").Select
    End Sub
    Attached Files Attached Files
    Last edited by mehmetcik; 02-09-2018 at 12:04 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    01-22-2018
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Re: Shopping list macro help

    Quote Originally Posted by mehmetcik View Post
    Why So complicated?

    Type the quantity in column B Entering Return could copy that line to the shopping list, but is pointless.

    Once you have entered your quantities click on a button to create the shopping list..... Much Better
    Thanks for taking a look. Yeah sure I appreciate that your method would be more simple, but the actual spreadsheet I would be applying this to could grow to having thousands of lines for the items, so I would prefer to be able to deal with each line on an individual basis. I may have to switch to your method if the way I would prefer to do it is not possible however.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Shopping list macro help

    If you are going to have thousands of lines then you should also look at using Groups.

    I created a couple of macros a few years back that you might like
    Attached Files Attached Files
    Last edited by mehmetcik; 02-09-2018 at 12:32 PM.

  5. #5
    Registered User
    Join Date
    01-22-2018
    Location
    UK
    MS-Off Ver
    2016
    Posts
    5

    Re: Shopping list macro help

    Quote Originally Posted by mehmetcik View Post
    If you are going to have thousands of lines then you should also look at using Groups.

    I created a couple of macros a few years back that you might like
    Thanks for your help, I'll look into it

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Making shopping list work for me
    By Dibble708 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 06-07-2017, 08:34 PM
  2. Create shopping list from drop down menu
    By paulahunter3 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-20-2017, 12:22 PM
  3. Shopping list creator
    By DrPips in forum Excel General
    Replies: 17
    Last Post: 09-23-2015, 10:39 AM
  4. Shopping List Calculator / Budgeting Spreadsheet
    By UTDating in forum Excel General
    Replies: 3
    Last Post: 07-09-2014, 09:02 PM
  5. Shopping list
    By Shawn1973 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-26-2013, 07:48 PM
  6. Itemized shopping list
    By jerryjaysr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-05-2007, 12:33 PM
  7. Excel Shopping List
    By robertguy in forum Excel General
    Replies: 1
    Last Post: 10-21-2005, 05:05 AM

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