![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Location: Toronto, Canada
Posts: 20
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
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 (My other life: http://damonostrander.com ) |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|