+ Reply to Thread
Results 1 to 7 of 7

"Print this" link in a cell??

  1. #1
    Forum Contributor
    Join Date
    06-29-2005
    Location
    TN
    MS-Off Ver
    Microsoft 365
    Posts
    327

    "Print this" link in a cell??

    Can you put a link in a cell, that when you click on it, it will print the current worksheet? How?

    Thanx.

  2. #2
    Nick Hodge
    Guest

    Re: "Print this" link in a cell??

    You could use the Workbook_SheetSelectionChange event if you want this to
    happen on all worksheets. If it is a specific sheet then use the
    worksheet_SelectionChange event behind the sheet concerned...

    Code like that below will work (Using selection on A1 on any worksheet)

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
    As Range)
    If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
    Sh.PrintOut
    End If
    End Sub

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    www.nickhodge.co.uk
    nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS


    "Ltat42a" <Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com> wrote in
    message news:Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com...
    >
    > Can you put a link in a cell, that when you click on it, it will print
    > the current worksheet? How?
    >
    > Thanx.
    >
    >
    > --
    > Ltat42a
    > ------------------------------------------------------------------------
    > Ltat42a's Profile:
    > http://www.excelforum.com/member.php...o&userid=24735
    > View this thread: http://www.excelforum.com/showthread...hreadid=478471
    >




  3. #3
    Forum Contributor
    Join Date
    06-29-2005
    Location
    TN
    MS-Off Ver
    Microsoft 365
    Posts
    327
    Quote Originally Posted by Nick Hodge
    You could use the Workbook_SheetSelectionChange event if you want this to
    happen on all worksheets. If it is a specific sheet then use the
    worksheet_SelectionChange event behind the sheet concerned...

    Code like that below will work (Using selection on A1 on any worksheet)

    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
    As Range)
    If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
    Sh.PrintOut
    End If
    End Sub

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    www.nickhodge.co.uk
    nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS


    "Ltat42a" <Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com> wrote in
    message news:Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com...
    >
    > Can you put a link in a cell, that when you click on it, it will print
    > the current worksheet? How?
    >
    > Thanx.
    >
    >
    > --
    > Ltat42a
    > ------------------------------------------------------------------------
    > Ltat42a's Profile:
    > http://www.excelforum.com/member.php...o&userid=24735
    > View this thread: http://www.excelforum.com/showthread...hreadid=478471
    >

    Thanx....where do I insert this code?

  4. #4
    Norman Jones
    Guest

    Re: "Print this" link in a cell??

    Hi Ltat42a,

    Nick's code represents a worksheet event procedure and should be pasted into
    the worksheets's code module (not a standard module and not the workbook's
    ThisWorkbook module):

    *******************************************
    Right-click the worksheet's tab
    Select 'View Code' from the menu and paste the code.
    Alt-F11 to return to Excel.
    *******************************************

    For information on Event procedures, see Chip Pearson at:

    http://www.cpearson.com/excel/events.htm

    For introductory information on macros see David McRitchie's 'Getting
    Started With Macros And User Defined Functions' at:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm


    ---
    Regards,
    Norman


    "Ltat42a" <Ltat42a.1xbyqc_1130029505.3674@excelforum-nospam.com> wrote in
    message news:Ltat42a.1xbyqc_1130029505.3674@excelforum-nospam.com...
    >
    > Nick Hodge Wrote:
    >> You could use the Workbook_SheetSelectionChange event if you want this
    >> to
    >> happen on all worksheets. If it is a specific sheet then use the
    >> worksheet_SelectionChange event behind the sheet concerned...
    >>
    >> Code like that below will work (Using selection on A1 on any
    >> worksheet)
    >>
    >> Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
    >> Target
    >> As Range)
    >> If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
    >> Sh.PrintOut
    >> End If
    >> End Sub
    >>
    >> --
    >> HTH
    >> Nick Hodge
    >> Microsoft MVP - Excel
    >> Southampton, England
    >> www.nickhodge.co.uk
    >> nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
    >>
    >>
    >> "Ltat42a" <Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com> wrote
    >> in
    >> message news:Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com...
    >> >
    >> > Can you put a link in a cell, that when you click on it, it will

    >> print
    >> > the current worksheet? How?
    >> >
    >> > Thanx.
    >> >
    >> >
    >> > --
    >> > Ltat42a
    >> >

    >> ------------------------------------------------------------------------
    >> > Ltat42a's Profile:
    >> > http://www.excelforum.com/member.php...o&userid=24735
    >> > View this thread:

    >> http://www.excelforum.com/showthread...hreadid=478471
    >> >

    >
    >
    > Thanx....where do I insert this code?
    >
    >
    > --
    > Ltat42a
    > ------------------------------------------------------------------------
    > Ltat42a's Profile:
    > http://www.excelforum.com/member.php...o&userid=24735
    > View this thread: http://www.excelforum.com/showthread...hreadid=478471
    >




  5. #5
    Nick Hodge
    Guest

    Re: "Print this" link in a cell??

    Norman

    Thanks for jumping in...on the contrary however. I have used, in the
    example, the 'workbook' version of the SheetSelectionChange event to fire on
    every sheet in the workbook. Therefore the actual example *should* be
    placed in the ThisWorkbook code module, unless, as I pointed out, the code
    was just required on one sheet. If this is the case, then follow Norman's
    advice and use the Worksheet Selection_Change event behind the required
    worksheet

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    www.nickhodge.co.uk
    nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS


    "Norman Jones" <normanjones@whereforartthou.com> wrote in message
    news:%23MSxM031FHA.2964@TK2MSFTNGP09.phx.gbl...
    > Hi Ltat42a,
    >
    > Nick's code represents a worksheet event procedure and should be pasted
    > into the worksheets's code module (not a standard module and not the
    > workbook's ThisWorkbook module):
    >
    > *******************************************
    > Right-click the worksheet's tab
    > Select 'View Code' from the menu and paste the code.
    > Alt-F11 to return to Excel.
    > *******************************************
    >
    > For information on Event procedures, see Chip Pearson at:
    >
    > http://www.cpearson.com/excel/events.htm
    >
    > For introductory information on macros see David McRitchie's 'Getting
    > Started With Macros And User Defined Functions' at:
    >
    > http://www.mvps.org/dmcritchie/excel/getstarted.htm
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    > "Ltat42a" <Ltat42a.1xbyqc_1130029505.3674@excelforum-nospam.com> wrote in
    > message news:Ltat42a.1xbyqc_1130029505.3674@excelforum-nospam.com...
    >>
    >> Nick Hodge Wrote:
    >>> You could use the Workbook_SheetSelectionChange event if you want this
    >>> to
    >>> happen on all worksheets. If it is a specific sheet then use the
    >>> worksheet_SelectionChange event behind the sheet concerned...
    >>>
    >>> Code like that below will work (Using selection on A1 on any
    >>> worksheet)
    >>>
    >>> Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
    >>> Target
    >>> As Range)
    >>> If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
    >>> Sh.PrintOut
    >>> End If
    >>> End Sub
    >>>
    >>> --
    >>> HTH
    >>> Nick Hodge
    >>> Microsoft MVP - Excel
    >>> Southampton, England
    >>> www.nickhodge.co.uk
    >>> nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
    >>>
    >>>
    >>> "Ltat42a" <Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com> wrote
    >>> in
    >>> message news:Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com...
    >>> >
    >>> > Can you put a link in a cell, that when you click on it, it will
    >>> print
    >>> > the current worksheet? How?
    >>> >
    >>> > Thanx.
    >>> >
    >>> >
    >>> > --
    >>> > Ltat42a
    >>> >
    >>> ------------------------------------------------------------------------
    >>> > Ltat42a's Profile:
    >>> > http://www.excelforum.com/member.php...o&userid=24735
    >>> > View this thread:
    >>> http://www.excelforum.com/showthread...hreadid=478471
    >>> >

    >>
    >>
    >> Thanx....where do I insert this code?
    >>
    >>
    >> --
    >> Ltat42a
    >> ------------------------------------------------------------------------
    >> Ltat42a's Profile:
    >> http://www.excelforum.com/member.php...o&userid=24735
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=478471
    >>

    >
    >




  6. #6
    Norman Jones
    Guest

    Re: "Print this" link in a cell??

    Hi Nick,

    My apologies- I mis-read the macro header.

    Thank you for the correction.

    ---
    Regards,
    Norman



    "Nick Hodge" <nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS> wrote in message
    news:%230xWZQ61FHA.3124@TK2MSFTNGP12.phx.gbl...
    > Norman
    >
    > Thanks for jumping in...on the contrary however. I have used, in the
    > example, the 'workbook' version of the SheetSelectionChange event to fire
    > on every sheet in the workbook. Therefore the actual example *should* be
    > placed in the ThisWorkbook code module, unless, as I pointed out, the code
    > was just required on one sheet. If this is the case, then follow Norman's
    > advice and use the Worksheet Selection_Change event behind the required
    > worksheet
    >
    > --
    > HTH
    > Nick Hodge
    > Microsoft MVP - Excel
    > Southampton, England
    > www.nickhodge.co.uk
    > nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
    >
    >
    > "Norman Jones" <normanjones@whereforartthou.com> wrote in message
    > news:%23MSxM031FHA.2964@TK2MSFTNGP09.phx.gbl...
    >> Hi Ltat42a,
    >>
    >> Nick's code represents a worksheet event procedure and should be pasted
    >> into the worksheets's code module (not a standard module and not the
    >> workbook's ThisWorkbook module):
    >>
    >> *******************************************
    >> Right-click the worksheet's tab
    >> Select 'View Code' from the menu and paste the code.
    >> Alt-F11 to return to Excel.
    >> *******************************************
    >>
    >> For information on Event procedures, see Chip Pearson at:
    >>
    >> http://www.cpearson.com/excel/events.htm
    >>
    >> For introductory information on macros see David McRitchie's 'Getting
    >> Started With Macros And User Defined Functions' at:
    >>
    >> http://www.mvps.org/dmcritchie/excel/getstarted.htm
    >>
    >>
    >> ---
    >> Regards,
    >> Norman
    >>
    >>
    >> "Ltat42a" <Ltat42a.1xbyqc_1130029505.3674@excelforum-nospam.com> wrote in
    >> message news:Ltat42a.1xbyqc_1130029505.3674@excelforum-nospam.com...
    >>>
    >>> Nick Hodge Wrote:
    >>>> You could use the Workbook_SheetSelectionChange event if you want this
    >>>> to
    >>>> happen on all worksheets. If it is a specific sheet then use the
    >>>> worksheet_SelectionChange event behind the sheet concerned...
    >>>>
    >>>> Code like that below will work (Using selection on A1 on any
    >>>> worksheet)
    >>>>
    >>>> Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
    >>>> Target
    >>>> As Range)
    >>>> If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
    >>>> Sh.PrintOut
    >>>> End If
    >>>> End Sub
    >>>>
    >>>> --
    >>>> HTH
    >>>> Nick Hodge
    >>>> Microsoft MVP - Excel
    >>>> Southampton, England
    >>>> www.nickhodge.co.uk
    >>>> nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
    >>>>
    >>>>
    >>>> "Ltat42a" <Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com> wrote
    >>>> in
    >>>> message news:Ltat42a.1xb9qc_1129997103.6962@excelforum-nospam.com...
    >>>> >
    >>>> > Can you put a link in a cell, that when you click on it, it will
    >>>> print
    >>>> > the current worksheet? How?
    >>>> >
    >>>> > Thanx.
    >>>> >
    >>>> >
    >>>> > --
    >>>> > Ltat42a
    >>>> >
    >>>> ------------------------------------------------------------------------
    >>>> > Ltat42a's Profile:
    >>>> > http://www.excelforum.com/member.php...o&userid=24735
    >>>> > View this thread:
    >>>> http://www.excelforum.com/showthread...hreadid=478471
    >>>> >
    >>>
    >>>
    >>> Thanx....where do I insert this code?
    >>>
    >>>
    >>> --
    >>> Ltat42a
    >>> ------------------------------------------------------------------------
    >>> Ltat42a's Profile:
    >>> http://www.excelforum.com/member.php...o&userid=24735
    >>> View this thread:
    >>> http://www.excelforum.com/showthread...hreadid=478471
    >>>

    >>
    >>

    >
    >




  7. #7
    Forum Contributor
    Join Date
    06-29-2005
    Location
    TN
    MS-Off Ver
    Microsoft 365
    Posts
    327
    I'm new to the Visual basic editor. I'm not understanding what all is involved to get this to work. In cell A1, I typed "Print This" (no quotes). I right clicked on the worksheet tab, pasted the code you provided......and nothing.

    Am I missing some steps?


    Thanx...

+ 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