index Reference letter change when i insert a column in refrence sheet

AbdulkareemAlhassni

New Member
Joined
Nov 16, 2018
Messages
41
hi guys,

i have an issue where the following index letter $E7$:$E$100000 changes whenever i enter a call to refrence sheet "Raw Data for PR Dist"

Code:
=IF(INDEX('Raw Data for PR Dist'!$E$7:$E$100000,MATCH(1,(A3='Raw Data for PR Dist'!$A$7:$A$100000)*(B3='Raw Data for PR Dist'!$B$7:$B$100000),0))="","",INDEX('Raw Data for PR Dist'!$E$7:$E$100000,MATCH(1,(A3='Raw Data for PR Dist'!$A$7:$A$100000)*(B3='Raw Data for PR Dist'!$B$7:$B$100000),0)))


such as when i run the vba the first time it will insert a column in the refrence sheet.

every time i run the Macro the same thing happen, thus $E7$:$E$100000 becomes $F7$:$F$100000 then $G7$:$G$100000...etc

how can i lock $E7$:$E$100000 to NOT change whenever i run the Macro ?

i saw something about indirect but am not sure if it will work or if there is a better solution.

THank you :)
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Are you inserting a column to the left of column E ?
If yes, then I'm not sure how to get round that.
One way, perhaps, would be to add some code to your existing macro so that it re-writes this formula correctly each time the code runs.
 
Upvote 0
Are you inserting a column to the left of column E ?
If yes, then I'm not sure how to get round that.
One way, perhaps, would be to add some code to your existing macro so that it re-writes this formula correctly each time the code runs.

i tried to re-write it but am getting error for Array

Code:
[COLOR=#0000BB][FONT=monospace]Range[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"D3"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]).[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Select    Selection[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]FormulaArray [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_   
      [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]  Range[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"D3"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]).[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Select    Selection[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]FormulaArray [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_   
     [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"=IF(INDEX('Raw Data for PR Dist'!R7C5:R100000C5,MATCH(1,('PR Dist SSD Report'!RC[-3]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-2]='Raw Data for PR Dist'!R7C2:R100000C2),0))="""","""",INDEX('Raw Data for PR Dist'!R7C5:R100000C5,MATCH(1,('PR Dist SSD Report'!RC[-3]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-2]='Raw Data for" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_       [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]" PR Dist'!R7C2:R100000C2),0)))" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]""            [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Range[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"E3"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]).[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Select    Selection[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]FormulaArray [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"=IF(INDEX('Raw Data for PR Dist'!R7C3:R100000C3,MATCH(1,('PR Dist SSD Report'!RC[-4]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-3]='Raw Data for PR Dist'!R7C2:R100000C2),0))="""","""",INDEX('Raw Data for PR Dist'!R7C3:R100000C3,MATCH(1,('PR Dist SSD Report'!RC[-4]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-3]='Raw Data for" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]" PR Dist'!R7C2:R100000C2),0)))" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]""            [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Range[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"F3"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]).[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Select    Selection[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]FormulaArray [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"=IF(INDEX('Raw Data for PR Dist'!R7C4:R100000C4,MATCH(1,('PR Dist SSD Report'!RC[-5]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-4]='Raw Data for PR Dist'!R7C2:R100000C2),0))="""","""",INDEX('Raw Data for PR Dist'!R7C4:R100000C4,MATCH(1,('PR Dist SSD Report'!RC[-5]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-4]='Raw Data for" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]" PR Dist'!R7C2:R100000C2),0)))" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]""            [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Range[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"J3"[/FONT][/COLOR][COLOR=#007700][FONT=monospace]).[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]Select    Selection[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]FormulaArray [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]"=IF(INDEX('Raw Data for PR Dist'!R7C35:R100000C35,MATCH(1,('PR Dist SSD Report'!RC[-9]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-8]='Raw Data for PR Dist'!R7C2:R100000C2),0))="""","""",INDEX('Raw Data for PR Dist'!R7C35:R100000C35,MATCH(1,('PR Dist SSD Report'!RC[-9]='Raw Data for PR Dist'!R7C1:R100000C1)*('PR Dist SSD Report'!RC[-8]='Raw Data" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]" for PR Dist'!R7C2:R100000C2),0)))" [/FONT][/COLOR][COLOR=#007700][FONT=monospace]& [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_        [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]""[/FONT][/COLOR]


Error ( 1004 VBA unable to set the formulaarray probery of the range class)

How can i fix it ?

i recorded the ( Writing the code then pasting it ) cuz i want it to automatically do it.

and also

would INDIRECT() work ?
 
Last edited:
Upvote 0
Do you want this to be an array formula ?
I can't even get this to be an array formula - pressing F2, then Control, Shift, Enter (which is the way I normally turn a formula into an array formula) doesn't seem to take any effect.
I'm not an expert on array formulas - could it be something to do with the formula referring to another worksheet ?
When I try this without the reference to another worksheet - in other words making the formula refer to the same worksheet that the formula sits on - it all seems to work OK.
 
Upvote 0
Do you want this to be an array formula ?
I can't even get this to be an array formula - pressing F2, then Control, Shift, Enter (which is the way I normally turn a formula into an array formula) doesn't seem to take any effect.
I'm not an expert on array formulas - could it be something to do with the formula referring to another worksheet ?
When I try this without the reference to another worksheet - in other words making the formula refer to the same worksheet that the formula sits on - it all seems to work OK.

because it is referring to another sheet

and this other sheet adds multiple columns when it runs everytime in the refrence sheet

the formula cell refrencing the other sheet gets updated
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,467
Members
452,516
Latest member
archcalx

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