+ Reply to Thread
Results 1 to 5 of 5

Increase/Decrease Print Range in Macro

  1. #1
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    292

    Thumbs up Increase/Decrease Print Range in Macro

    Hi All,

    I have a sheet fro example from A1 to z100..

    I had recoreded a macro to print this area by a button, but daily some date have to remove and some have to add..hense, some time i remains 90 rows and some time 110 rows..

    Is there a macro so that print range should automatically adjusted and macro button can print automatically without editing for rows 110 or 90 or whatever..

    I hope this is not a hard for you guys..

    Thanks in advance..

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

    Re: Increase/Decrease Print Range in Macro

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    292

    Re: Increase/Decrease Print Range in Macro

    Thanks for quick response..

    An error is apperaing while i insert module..

    RUN TIME 1004, METHOD RANGE OF OBJECT _GLOBAL FAILED..

    and secondaly I have 3 ranges in one sheet to print with 3 different macro..for example from A1 to A50 and A55 to Z100 and A105 to Z150..

    i want a macro who can print from A1:Z untill any blank row is there..and than same as A55:Z and than A105:Z..

    Thanks in advance
    Last edited by tariqnaz2005; 11-11-2009 at 03:40 AM.

  4. #4
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    292

    Re: Increase/Decrease Print Range in Macro

    Sub test()
    Dim LastRowToPrint As Long
    Dim PrintArea As Range
    Dim FirstCellToPrint As String
    Dim LastColumnToPrint As String

    FirstCellToPrint = "A1"
    LastColumnToPrint = "E"

    'Find the last row of data:
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row

    Set PrintArea = Range(FirstCellToPrint & ":" & LastColumnToPrint & LastRowToPrint)


    End Sub__________________
    Hi Protinelea or all,

    as i received code Avove ..an error is coming if i insert it ..

    can some one check it and correct it for me..thanks

  5. #5
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Increase/Decrease Print Range in Macro

    !!!

    Corss-posted w/out references

    http://www.excelforum.com/excel-gene...t-a-range.html

    ProtonLeah - no option explicit? Naughty naughty...

+ 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