+ Reply to Thread
Results 1 to 10 of 10

Multiple issues regarding print, formatting, and form generating

  1. #1
    Registered User
    Join Date
    05-27-2009
    Location
    Bucharest Romania
    MS-Off Ver
    Excel 2007
    Posts
    29

    Multiple issues regarding print, formatting, and form generating

    Hello,

    With your help in the past, i've created the excel file in the attachment:
    it looks up values, using "coordinates" in different sheets of the excel

    What i can't do, or i don't know how is:

    1. I want to make a print button, on the "calculatie" sheet, for the range a4:d34, but i want it to print only if it has values in columns b or c (or only one of them), because i don't want to print a full empty list with only 2 or 3 or "n" rows.

    The print button is kind of done, , but i don't know how to remove rows that have no data in them.

    the macro used is:

    PHP Code: 
    Sub MyPrint()
     
    curPrtArea ActiveSheet.PageSetup.PrintArea
      myPrtArea 
    "E3:G20"
       
    ActiveSheet.PageSetup.PrintArea myPrtArea
       ActiveSheet
    .PrintOut
     ActiveSheet
    .PageSetup.PrintArea curPrtArea
    End Sub 
    2. For economic reasons, i would like that when i press the button, the filled color in cells should not be printed, so i would print only in black and white. Is there any command that i can insert in the macro so the color filling is not printed?

    There's more, but i haven't got to that part yet
    Attached Files Attached Files

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Multiple issues regarding print, formatting, and form generating

    try setting black
    and white cell colours wont print
    Please Login or Register  to view this content.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Multiple issues regarding print, formatting, and form generating

    Your code sets the PrintArea for a different range than the one you mention in the post
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Multiple issues regarding print, formatting, and form generating

    Put this at the top of your macro to check if any cells contain data
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-27-2009
    Location
    Bucharest Romania
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple issues regarding print, formatting, and form generating

    Quote Originally Posted by martindwilson View Post
    try setting black
    and white cell colours wont print
    Please Login or Register  to view this content.
    Thank you, it worked!

  6. #6
    Registered User
    Join Date
    05-27-2009
    Location
    Bucharest Romania
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple issues regarding print, formatting, and form generating

    Quote Originally Posted by royUK View Post
    Your code sets the PrintArea for a different range than the one you mention in the post
    Yes roy, if you will download the xls file you will understand

  7. #7
    Registered User
    Join Date
    05-27-2009
    Location
    Bucharest Romania
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple issues regarding print, formatting, and form generating

    Quote Originally Posted by royUK View Post
    Put this at the top of your macro to check if any cells contain data
    Please Login or Register  to view this content.
    nope...doesn't work...

    So... in column A i have the criteria number (1,2.3...)... column B (width), column C (height), column D price.

    The desired effect is that when i push the print button, it will get printed only the last row with data in Column B and C, independent of column A or D

    The macro command used, but not working:
    PHP Code: 
    Sub PrintRulouri()
     If 
    Application.WorksheetFunction.CountA(Range("b5:c34")) = 0 Then Exit Sub
     curPrtArea 
    ActiveSheet.PageSetup.PrintArea
      myPrtArea 
    "a3:d34"
       
    With ActiveSheet.PageSetup
       
    .PrintArea myPrtArea
       
    .BlackAndWhite True
       End With
       ActiveSheet
    .PrintOut
     ActiveSheet
    .PageSetup.PrintArea curPrtArea
    End Sub 
    Any ideas?

  8. #8
    Registered User
    Join Date
    05-27-2009
    Location
    Bucharest Romania
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple issues regarding print, formatting, and form generating

    nobody can help?

  9. #9
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Multiple issues regarding print, formatting, and form generating

    The macro below tests columns B & C to determine which is longer and uses that one to set the print area:
    Please Login or Register  to view this content.
    Last edited by protonLeah; 02-13-2011 at 10:47 PM.
    Ben Van Johnson

  10. #10
    Registered User
    Join Date
    05-27-2009
    Location
    Bucharest Romania
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple issues regarding print, formatting, and form generating

    Quote Originally Posted by protonLeah View Post
    The macro below tests columns B & C to determine which is longer and uses that one to set the print area:
    Please Login or Register  to view this content.
    Thank you! it works like a charm

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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