ozan efendi
New Member
- Joined
- Nov 6, 2012
- Messages
- 17
Hi, ihave this code below and it gets data from sheet1 and does index and match function. But, the problem is, while i am using this function in sheet2, i can get the results flawlessly. But when i change the reference cells value in sheet1, nothing happens. I guess, that is because the "Activesheet.EnableCalculation" code. It only triggers if i change a cell value in sheet2 (i write the function in sheet2). I' m trying to fix this for two days, unfortunalety i couldn' t find. Can anyone help on this macro? Thanks.
Code:
Function Index_func1(x As Variant, y As Variant) As Variant
Dim Model As Variant
Dim Bakim As Variant
ActiveSheet.EnableCalculation = False
Model = Application.Match(x, Worksheets("Sheet1").Range("a1:a10000"), 0)
Bakim = Application.Match(y, Worksheets("Sheet1").Range("a1:dd1"), 0)
Index_func1 = Application.Index(Worksheets("Sheet1").Range("a1:dd10000"), Model, Bakim)
ActiveSheet.EnableCalculation = True
End Function