Do I need to specify the sheet in the absence of Thissheet

showard1

New Member
Joined
Aug 5, 2010
Messages
14
Hi

I am developing a UDF, which takes inputs from the sheet that it exists on, plus a reference sheet.

The function will exist on a number of sheets in the same workbook.

I am happy collecting the inputs from a defined reference (common) sheet however when I am collecting the inputs from the sheet on which the function is acting, if I omit the worksheet("xxx") from the input line, will this effectivly be the same as the missing "ThisWorksheet" string.

The reason I ask, is the function will exist on several worksheets, there will be global recalculate routine, so several of the sheets will not be active at the time of the routine.

Thanks for any guidance

S
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Am still struggling with this. Here is an abreviated section of the code

Code:
Function FCastMonth(ThisMonth)
Application.Volatile
established = DateDiff("m", Range("H6").Value, ThisMonth)
If established >= Range("SCALE").Value Then
    ScaleUp = 1
    Else
    ScaleUp = established / Range("SCALE").Value
    End If

Crit1 = ScaleUp * Range("CR1W").Value
Crit2 = Range("H11").Value / 10 * Range("CR2W").Value
Crit3 = Range("H13").Value / 10 * Range("CR3W").Value
Crit4 = Range("H15").Value / 10 * Range("CR4W").Value
Crit5 = Range("H17").Value / 10 * Range("CR5W").Value
 
FAdjust = WorksheetFunction.Sum(Crit1, Crit2, Crit3, Crit4, Crit5)
 
FCastMonth = FAdjust * Range("TargRev").Value
 
End Function

My problem is the named ranges come from a defined sheet in the workbook so are easy to gather, however the coded ranges H11, 13 etc need to refer to the cell on the sheet that the UDF is, not necessarily the activesheet.

Any help still greatfully received.
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,792
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top