Afternoon,
I am hoping someone can help me with this. I have lots of dynamic index and matches needing to be placed in one formula and it is getting very long and messy.
As a result, I need to create functions for each one of them to shorten the formulas. I am struggling to get the below example of a function to work though.
Can someone please help
Example function VBA code:
Function Test(Month, Asset_type)
Test = Application.WorksheetFunction.Index(Range("Range_numb_disposed"), _
Application.WorksheetFunction.Match(Month,(Range("Range_acq.schd_months"), 0), _
Application.WorksheetFunction.Match(Asset_type,(Range("Range_asset_name"), 0) – 1)
End Function
*simply using _in the above code to split the same code onto another line as gets very long.
Dynamic range code:
Range_numb_disposed = OFFSET('Disposition schedule'!$G$3,0,0,COUNTA('Disposition schedule'!$G:$G)-2,4)
Range_acq.schd_months = OFFSET('Acquisition schedule'!$A$3,0,0,COUNTA('Acquisition schedule'!$A:$A),1)
Range_asset_name = 'Acquisition schedule'!$B$2:$F$2
Thank you for the help in advance,
Steven
I am hoping someone can help me with this. I have lots of dynamic index and matches needing to be placed in one formula and it is getting very long and messy.
As a result, I need to create functions for each one of them to shorten the formulas. I am struggling to get the below example of a function to work though.
Can someone please help
Example function VBA code:
Function Test(Month, Asset_type)
Test = Application.WorksheetFunction.Index(Range("Range_numb_disposed"), _
Application.WorksheetFunction.Match(Month,(Range("Range_acq.schd_months"), 0), _
Application.WorksheetFunction.Match(Asset_type,(Range("Range_asset_name"), 0) – 1)
End Function
*simply using _in the above code to split the same code onto another line as gets very long.
Dynamic range code:
Range_numb_disposed = OFFSET('Disposition schedule'!$G$3,0,0,COUNTA('Disposition schedule'!$G:$G)-2,4)
Range_acq.schd_months = OFFSET('Acquisition schedule'!$A$3,0,0,COUNTA('Acquisition schedule'!$A:$A),1)
Range_asset_name = 'Acquisition schedule'!$B$2:$F$2
Thank you for the help in advance,
Steven