+ Reply to Thread
Results 1 to 2 of 2

Pull text from one sheet to another

Hybrid View

  1. #1
    Registered User
    Join Date
    05-21-2014
    Posts
    1

    Pull text from one sheet to another

    Hi..

    I have a master list of items on sheet 2 (Column A) and then the quantity of those items in column B. This sheet is linked to a planogram in sheet 1 and will pull the item name if the section is in use. If no item is listed in a particular cell on the planogram it pulls a "0". I want to pull only the items with names on the master list (sheet 2) to another sheet (3). Basically I am trying to consolidate only those items with names and quantities. This may be confusing so I have a diagram below...

    Sheet 1
    Fish 4
    0 0
    Pork 2
    0 0

    Sheet 2
    Fish 4
    Pork 2

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,705

    Re: Pull text from one sheet to another

    Try this:

    Option Explicit
    
    Sub gllandry()
        Dim lr As Long
        lr = Range("A" & Rows.Count).End(xlUp).Row
        
        ActiveSheet.Range("A1:B" & lr).AutoFilter Field:=1, Criteria1:="<>0", _
            Operator:=xlAnd
        Range("A2:B" & lr).Copy Sheets("Sheet2").Range("A1")
    
    End Sub
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. [SOLVED] VBA to pull data from worksheet to a new sheet based on specific text cell value
    By TalResha in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-13-2013, 02:11 AM
  2. Macro to Pull Info from Product Line Sheet to Purchase Order Sheet
    By JeffreyJr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2012, 11:16 AM
  3. Replies: 4
    Last Post: 09-05-2012, 05:57 PM
  4. Replies: 4
    Last Post: 08-29-2012, 10:32 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