Help using indirect to reference a defined range in another spread

Q

QuietMan

The indirect is pointing to the cell that has the name of the defined range
that is referenced to another file.

Thanks

Sub Add_Data_Pull_Formulas_New()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Current_Sheet = ActiveSheet.Name

Set RangeToCheck = ActiveCell.CurrentRegion
Set NewRange = Range(RangeToCheck.Cells(8, 2),
RangeToCheck.Cells(RangeToCheck.Rows.Count, RangeToCheck.Columns.Count))
ActiveWorkbook.Names.Add Name:=Current_Sheet, RefersToR1C1:=NewRange

With Range(Current_Sheet)
.FormulaR1C1 =
"=SUMIF(NDIRECT(R5C),RC1,OFFSET(NDIRECT(R5C),0,R1C,ROWS(NDIRECT(R5C)),1))"
.Value = .Value
End With
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top