Increase Cell References by X in Formulas Macro

%3CLINGO-SUB%20id%3D%22lingo-sub-3238803%22%20slang%3D%22en-US%22%3EIncrease%20Cell%20References%20by%20X%20in%20Formulas%20Macro%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3238803%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20searching%20the%20net%20for%20a%20possible%20solution%20but%20I%20couldn't%20find%20what%20I%20need%20wherever%20I%20looked.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20increment%20all%20cell%20references%20in%20formulas%20by%20X%20or%201%20in%20a%20selected%20or%20defined%20range%20in%20a%20specific%20sheet%20or%20active%20sheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20anyone%20help%20me%20with%20that%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20tried%20this%20but%20it%20doesn't%20do%20anything.%3C%2FP%3E%3CPRE%3ESub%20Increment()%0ARange(%22A2%3AA400%22).Select%0ASelection.Offset(1%2C%200).Select%0AEnd%20Sub%3C%2FPRE%3E%3CP%3EI'd%20really%20appreciate%20your%20help.%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3238803%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3238861%22%20slang%3D%22en-US%22%3ERe%3A%20Increase%20Cell%20References%20by%20X%20in%20Formulas%20Macro%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3238861%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142876%22%20target%3D%22_blank%22%3E%40kheldar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DINDIRECT(%22A%22%26amp%3BROW(%24A%243)%2B(ROW(A1)-1)*%24F%241)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EMaybe%20like%20this%3F%20In%20cell%20F1%20you%20can%20enter%20the%20X%20or%201%20by%20which%20you%20want%20the%20cell%20reference%20to%20increment.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3238869%22%20slang%3D%22en-US%22%3ERe%3A%20Increase%20Cell%20References%20by%20X%20in%20Formulas%20Macro%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3238869%22%20slang%3D%22en-US%22%3EHmm%20would%20that%20work%20with%20different%20formulas%3F%20Because%20many%20of%20the%20cells%20have%20different%20formulas.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3238921%22%20slang%3D%22en-US%22%3ERe%3A%20Increase%20Cell%20References%20by%20X%20in%20Formulas%20Macro%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3238921%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1142876%22%20target%3D%22_blank%22%3E%40kheldar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3ECan%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eyo%3C%2FSPAN%3E%3CSPAN%3Eu%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eshare%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Ethe%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eother%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eformulas%3C%2FSPAN%3E%3CSPAN%3E%3F%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EIn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eprinciple%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ethis%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eshould%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Ealso%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Ebe%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Epossible%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Ewith%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eother%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3Eformulas%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hello,

 

I have been searching the net for a possible solution but I couldn't find what I need wherever I looked.

 

I need to increment all cell references in formulas by X or 1 in a selected or defined range in a specific sheet or active sheet.


A note:

 

The structure of all cells and formulas doesn't allow autofill.

 

Could anyone help me with that?

 

I've tried this but it doesn't do anything.

Sub Increment()
Range("A2:A400").Select
Selection.Offset(1, 0).Select
End Sub

I'd really appreciate your help.

6 Replies

@kheldar 

=INDIRECT("A"&ROW($A$3)+(ROW(A1)-1)*$F$1)

Maybe like this? In cell F1 you can enter the X or 1 by which you want the cell reference to increment.

Hmm would that work with different formulas? Because many of the cells have different formulas.

@kheldar 

Can you share the other formulas? In principle, this should also be possible with other formulas.

@Quadruple_Pawn 

 

Well they are fairly simple since they are to build a lookup table from a horribly designed table.

 

 

 

=IF('Queue Assignment - Mid'!A27=0,"",'Queue Assignment - Mid'!A27)

=IF(OR('Queue Assignment - Mid'!H6=0,'Queue Assignment - Mid'!H6="No Lunch"),"",'Queue Assignment - Mid'!H6)

=LET(calc,'Queue Assignment - Morning'!E6,IF(calc=0,"",calc))

 

 

 I switched to LET after awhile because I got lazy with copy pasting. should have done it earlier .

 

But I should let you know that I'm resorting to a macro because I can't just click and drag formulas because almost all of them are different in a way that it doesn't allow flashfill.

@kheldar 

Sub Makro1()

    ActiveCell.FormulaR1C1 = _
        "=IF('Queue Assignment - Mid'!R[20]C[-1]=0,"""",'Queue Assignment - Mid'!R[20]C[-1])"

End Sub

These lines were recorded with the macro recorder. You can activate the cell where you want to enter the formula and run the macro. This could be what you want to do.

 

Yeah I tried that as well... it messes up ROW references...