+ Reply to Thread
Results 1 to 7 of 7

VBA - define print on other sheet by cell value

  1. #1
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    VBA - define print on other sheet by cell value

    Hello My friends,

    I need simple macro which i will start from "Sheet1" via button, and it should define print area on "Sheet2". Start point of range is always A1, and end point taken from cell B1 (which will vary) on Sheet2"

    Example file with manual solution is attached

    Really appreciate for your help
    Attached Files Attached Files

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA - define print on other sheet by cell value

    Since you are using a Form Controls button, the macro should be copied to the standard code module1.
    Please Login or Register  to view this content.
    Right click your button to assign the macro.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: VBA - define print on other sheet by cell value

    Thx for reply, but in the end I received an error Run time error 1004 - "Method Range of object _Global failed"

    How I should modify code if target sheet name "Chart" and final point is cell "F69" on sheet "Chart"? This cell F69 contain only text "OS57", so full print area should be "A1:OS57"

    Thanks in advance for helping me

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: VBA - define print on other sheet by cell value

    I thought you said that cell B1 would contain the final cell reference.
    As for the sheet name, just change "Sheet2" to "Chart". Where i used Range("B1"), substitute whichever cell you use to identify the last cell of the range to print.
    This cell F69 contain only text "OS57", so full print area should be "A1:OS57"
    This is a confusing statement. Are you saying that instead of B1 on sheet Chart that you are using cell F69 to define the last cell of the print range? If so, Then

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: VBA - define print on other sheet by cell value

    Dear JlGWhiz,

    It is not a confusion: cell F69 used in my real workbook and B1 only in example.

    Sorry, but i received again error ("Compile error: Syntax error")

    In my cell F69 calculated last column for the print area with formulas =CONCATENATE(F68,"57"), where F68 required last column of my chart and value 57 is last row and it always constant.

    What can be an issue?

    Thx in advance!

  6. #6
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: VBA - define print on other sheet by cell value

    Ah, i found mistake Sheets("Chart")

    Anyway, thank you very much! Everything OK!

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: VBA - define print on other sheet by cell value

    Try
    Please Login or Register  to view this content.

+ 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] Define Print Area
    By plans in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2015, 08:34 AM
  2. Use VBA to define print area?
    By mailrush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2015, 08:57 AM
  3. Different sheet refernce using a formula to define the cell reference
    By tritty in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-06-2013, 11:16 PM
  4. How to define a cell name and reference it in a differen sheet
    By shaunsul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2011, 01:27 PM
  5. define Dynamic Print Area
    By ac48 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2009, 11:33 AM
  6. Replies: 1
    Last Post: 11-24-2005, 07:29 AM
  7. [SOLVED] define a print area and name it based on info in first cell in a row...
    By Chris Salcedo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-06-2005, 09:05 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