+ Reply to Thread
Results 1 to 4 of 4

Print certain rows of certain columns based on variable

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-20-2014
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    177

    Print certain rows of certain columns based on variable

    Good morning,

    I would like to make a print macro which will print certain cell values of certain columns when the row has met the right condition. In this example "yes"
    See attached.

    So in this example I would like to print row 3,4, 7 and 9 but only the values from column A,B,C and G.

    Thanks in advance!
    Attached Files Attached Files
    Last edited by Gaellus; 03-17-2017 at 08:25 AM.

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Print certain rows of certain columns based on variable

    Maybe

    Sub test()
    Range("A2").CurrentRegion.AutoFilter 9, Criteria1:="Yes"
    Range("D:F").EntireColumn.Hidden = True
    Range("H:I").EntireColumn.Hidden = True
    Range("A2").CurrentRegion.PrintPreview
    ActiveSheet.Columns.Hidden = False
    Range("A2").CurrentRegion.AutoFilter
    End Sub
    Kind regards
    Leo

  3. #3
    Forum Contributor
    Join Date
    11-20-2014
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    177

    Re: Print certain rows of certain columns based on variable

    Works like a charm. Thanks

  4. #4
    Forum Contributor
    Join Date
    11-20-2014
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    177

    Re: Print certain rows of certain columns based on variable

    NVM. not necessary anymore
    Last edited by Gaellus; 03-17-2017 at 08:25 AM.

+ 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. sorting columns based on row criteria, with variable number of columns
    By bardobhb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-02-2014, 04:02 PM
  2. [SOLVED] Dynamic summing of columns based on variable rows and dates
    By Swept in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-15-2013, 01:33 PM
  3. Print a variable range based on cell reference
    By aondrusek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2012, 09:27 PM
  4. Print Area:last row is variable depending on how many rows
    By mafiaxts4life in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-08-2011, 02:37 AM
  5. Macro to print variable number of rows
    By dpcp in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-14-2011, 01:12 PM
  6. Transpose Columns To Rows (with Variable Columns)
    By G.HendriX in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-08-2011, 08:40 PM
  7. Variable Print Area Macro Based on Cell Value
    By cuclay in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2009, 08:26 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