VBA macros for formula is adding an @ infront of my reference points, making them invalid.

thiamle

New Member
Joined
Nov 20, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi so the issue is that i'm supposed to getting this formula here "
=IFERROR(INDEX(DB_DBS_Deposits!H$2:H$100000, SMALL(IF((DB_DBS_Deposits!F$2:F$100000=E169)*(DB_DBS_Deposits!H$2:H$100000=G169), ROW(DB_DBS_Deposits!H$2:H$100000)-ROW(DB_DBS_Deposits!H$2)+1), 1)), "")
"

but instead after running my macro, i'm greeted with =IFERROR(@INDEX(DB_DBS_Deposits!H$2:H$100000, SMALL(IF((@DB_DBS_Deposits!F$2:F$100000=E169)*(@DB_DBS_Deposits!H$2:H$100000=G169),@ ROW(DB_DBS_Deposits!H$2:H$100000)-ROW(DB_DBS_Deposits!H$2)+1), 1)), "").

which ultimately makes my macro fail.
Piece of code used:

For i = 2 To reconLastRow ' Assuming your data starts from row 1
If Not newSheet.Rows(i).Hidden Then ' Check if the row is visible (not hidden by a filter)
newSheet.Cells(i, 6).Formula = "=IFERROR(INDEX(DB_DBS_Deposits!R2C[2]:R100000C[2], SMALL(IF((DB_DBS_Deposits!R2C:R100000C=RC[-1])*(DB_DBS_Deposits!R2C[2]:R100000C[2]=RC[1]), ROW(DB_DBS_Deposits!R2C[2]:R100000C[2])-ROW(DB_DBS_Deposits!R2C[2])+1), 1)), """")"
End If
Next
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try changing this to Formula2

Rich (BB code):
newSheet.Cells(i, 6).Formula2 =
 
Upvote 1
Solution

Forum statistics

Threads
1,215,101
Messages
6,123,087
Members
449,095
Latest member
gwguy

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