Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Using a macro to set print parameters...

  1. #1
    New Member
    Join Date
    May 2002
    Location
    Toronto, Canada
    Posts
    20
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi.

    I am trying to get a macro to set print parameters based on the range that my HLookup formula finds.

    Here's what I have so far:
    : pageset = Application.WorksheetFunction.HLookup(B44, [A40:L41], 2)
    ActiveSheet.PageSetup.PrintArea = pageset

    I seem to have entered the Hlookup formula incorrectly. Can someone please help?

    Thanks.

    Bill.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Bill,

    To be correct from the syntax standpoint, it has to be:

    Application.WorksheetFunction.HLookup([B44], [A40:L41], 2)

    because B44 is a range object. Also, in order to work, the values that it returns from the table must be text strings that are A1-style range references such as "B4:M44".

    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •