Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default global user-defined name (range) - or help with holidays

not sure if should post here or in the main excel group, but since i'm utilizing VBA i'll put it here first.
on sheet1.xlsm i have a user defined name range of dates named holidays used to calculate target dates (ex, mid-month target for febuary, typically the 15th, is actually the 12th this year due to weekend/holiday)

on the vba code i am creating sheet2 that uses a formula that figures out the mid-month target, but the 'holiday' part is not working since the named range is on sheet1 but the formula is created on sheet2 -

the formula in it's full glory -
=WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+(DAY(WO RKDAY(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY( ))-1),1))15),16),-1,holidays)

the simple answer is to have the formula placed someplace in sheet1 where the named range exists, but with some other things going on, it is likely more cumbersome to make the adjustments to do this than to make the 'holidays' named range work in sheet2. so, how do i make the named range global? thank you in advance!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default global user-defined name (range) - or help with holidays

Matthew,
I like to avoid using global scope names as much as possible for many
reasons. If you want to ref local scope names from another sheet...

=WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+(DAY(WO RKDAY(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY( ))-1),1))15),16),-1,sheet1!holidays)

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default global user-defined name (range) - or help with holidays

That worked! just had additional info since it's not just in a diff sheet but in a diff excel book altogether, but figured it out. Thanks for pointing me in the right direction!

On Wednesday, February 3, 2016 at 4:06:09 PM UTC-7, Matthew Dyer wrote:
not sure if should post here or in the main excel group, but since i'm utilizing VBA i'll put it here first.
on sheet1.xlsm i have a user defined name range of dates named holidays used to calculate target dates (ex, mid-month target for febuary, typically the 15th, is actually the 12th this year due to weekend/holiday)

on the vba code i am creating sheet2 that uses a formula that figures out the mid-month target, but the 'holiday' part is not working since the named range is on sheet1 but the formula is created on sheet2 -

the formula in it's full glory -
=WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+(DAY(WO RKDAY(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY( ))-1),1))15),16),-1,holidays)

the simple answer is to have the formula placed someplace in sheet1 where the named range exists, but with some other things going on, it is likely more cumbersome to make the adjustments to do this than to make the 'holidays' named range work in sheet2. so, how do i make the named range global? thank you in advance!


that
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default global user-defined name (range) - or help with holidays

That worked! just had additional info since it's not just in a diff
sheet but in a diff excel book altogether, but figured it out. Thanks
for pointing me in the right direction!

On Wednesday, February 3, 2016 at 4:06:09 PM UTC-7, Matthew Dyer
wrote:
not sure if should post here or in the main excel group, but since
i'm utilizing VBA i'll put it here first. on sheet1.xlsm i have a
user defined name range of dates named holidays used to calculate
target dates (ex, mid-month target for febuary, typically the 15th,
is actually the 12th this year due to weekend/holiday)

on the vba code i am creating sheet2 that uses a formula that
figures out the mid-month target, but the 'holiday' part is not
working since the named range is on sheet1 but the formula is
created on sheet2 -

the formula in it's full glory -
=WORKDAY(DATE(YEAR(TODAY()),MONTH(TODAY())+(DAY(WO RKDAY(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY( ))-1),1))15),16),-1,holidays)

the simple answer is to have the formula placed someplace in sheet1
where the named range exists, but with some other things going on,
it is likely more cumbersome to make the adjustments to do this than
to make the 'holidays' named range work in sheet2. so, how do i make
the named range global? thank you in advance!


that


That's great! Also good you figured out the additional syntax for how
to ref a sheet in another workbook.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined Range caveman.savant Excel Programming 3 February 13th 09 02:59 PM
User-defined range for graph royend Excel Discussion (Misc queries) 3 September 4th 07 09:11 AM
User Defined Functions - local or global? Simon Excel Worksheet Functions 5 September 27th 06 09:15 AM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"