+ Reply to Thread
Results 1 to 10 of 10

VBA code to only print rows with matching names in column J

  1. #1
    Forum Contributor
    Join Date
    07-01-2010
    Location
    Niles, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    137

    VBA code to only print rows with matching names in column J

    Could someone help me with getting this figured out. In sheet 1 I have data in rows 4:329. What I would like to do is be able to create a macro that will look in column J and find all the matching Names (which should be around 15 rows) and then print only those rows. But I need it to print columns B:N when it finds the matching names.

    Thanks in advance

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA code to only print rows with matching names in column J

    Is the data in Column J sorted?

  3. #3
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: VBA code to only print rows with matching names in column J

    You think that you could upload a file with a few (not-sensible) rows ?
    Where are the data located? What kind of data is in column J?
    My first idea was to filter the whole table on a criteria from a inputbox on column J and then to printout the resulting sheet.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  4. #4
    Forum Contributor
    Join Date
    07-01-2010
    Location
    Niles, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    137

    Re: VBA code to only print rows with matching names in column J

    No it is not. The data in column D is sorted. And I need it that way because it's dates sorted ascending.

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: VBA code to only print rows with matching names in column J

    Quote Originally Posted by Zimmerman View Post
    Could someone help me with getting this figured out. In sheet 1 I have data in rows 4:329. What I would like to do is be able to create a macro that will look in column J and find all the matching Names (which should be around 15 rows) and then print only those rows. But I need it to print columns B:N when it finds the matching names.
    What do you mean by "find all the matching Names"... matching what?

  6. #6
    Forum Contributor
    Join Date
    07-01-2010
    Location
    Niles, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    137

    Re: VBA code to only print rows with matching names in column J

    The same name. So if column J had 15 cells in that had the name Bob. I want to print only those rows that have Bob in column J

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: VBA code to only print rows with matching names in column J

    Quote Originally Posted by Zimmerman View Post
    The same name. So if column J had 15 cells in that had the name Bob. I want to print only those rows that have Bob in column J
    I guess my actual question (using the name you just posted)... how do we know the name is Bob? Is the name going to appear in a certain cell (if so, which cell)?... or will the name always be the same (Bob)?... or will the name be assumed from the value in the active cell?... or should the program ask you what the name is?... something else?

    Oh, by the way, you said this in your original post, "But I need it to print columns B:N when it finds the matching names"... printed where?

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: VBA code to only print rows with matching names in column J

    Something like this? See attached.
    Select a name from the listbox when you open the workbook.
    Download and save the workbook macro enabled.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    07-01-2010
    Location
    Niles, Michigan
    MS-Off Ver
    Excel 2010
    Posts
    137

    Re: VBA code to only print rows with matching names in column J

    jolivanes that is perfect!!! Thank you so much!!

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: VBA code to only print rows with matching names in column J

    Thanks for the heads up
    Maybe this is better as you can change things before you need to make a decision.
    Good luck
    Attached Files Attached Files

+ 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 code assistance to print rows based on column date value
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2016, 09:54 AM
  2. need vba code to validate the names from names of group in column a:a
    By johnlara in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-07-2016, 11:28 AM
  3. Matching Last Names in two column and choose one
    By Taisir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-24-2014, 01:23 AM
  4. VBA code to print rows based on value in select column
    By deadeyesky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 10:50 AM
  5. [SOLVED] Search a column and code all rows with matching value in another column
    By lazypony in forum Excel Formulas & Functions
    Replies: 37
    Last Post: 08-03-2013, 11:23 AM
  6. Merging rows of data by matching names
    By Ktap in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2012, 05:25 PM
  7. Matching column names
    By rwab in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-06-2008, 10:36 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