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
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