Hey,
I have the code below which builds up an array of data and formulas the applies that array as a range. This is fine except is always comes out as absolute. I then got the code in at the bottom to find ranges of formulas and change them to relative after the data has rendered. This logic works fine on other worksheets but on this worksheet I get the error TypeMismatch when the line RdoRange.Areas(ranges).Formula = _
Application.ConvertFormula _
(Formula:=RdoRange.Areas(ranges).Formula, _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlA1, ToAbsolute:=xlRelative gets hit. Could anyone see what could be going wrong here?
'Outstanding - Other
TempArray(Currenti, colSummaryOutstandingOther) = _
"=SUMIF( Outstanding!" & Range(Cells(intSheetStartRow, colNotInvoicedKey1), Cells(65000, colNotInvoicedKey1)).Address & _
", " & Range(Cells(intRow, colSummaryKey1), Cells(intRow, colSummaryKey1)).Address & " & ""/Other""" & _
", Outstanding!" & Range(Cells(intSheetStartRow, colInvoicedSplitTotal), Cells(65000, colInvoicedSplitTotal)).Address & ")" & _
"+SUMIF( PostPay!" & Range(Cells(intSheetStartRow, colNotInvoicedKey1), Cells(65000, colNotInvoicedKey1)).Address & _
", " & Range(Cells(intRow, colSummaryKey1), Cells(intRow, colSummaryKey1)).Address & " & ""/Other""" & _
", PostPay!" & Range(Cells(intSheetStartRow, colInvoicedSplitTotal), Cells(65000, colInvoicedSplitTotal)).Address & ")"
'Outstanding - Total
TempArray(Currenti, colSummaryOutstandingTotal) = _
"=R" & intRow & "C" & colSummaryOutstandingCore & _
"+R" & intRow & "C" & colSummaryOutstandingCoreSL & _
"+R" & intRow & "C" & colSummaryOutstanding3Party & _
"+R" & intRow & "C" & colSummaryOutstanding3PartySL & _
"+R" & intRow & "C" & colSummaryOutstandingProduct & _
"+R" & intRow & "C" & colSummaryOutstandingOther
'Total
TempArray(Currenti, colSummaryTotalCore) = "=R" & intRow & "C" & colSummaryInvoicedCore & "+R" & intRow & "C" & colSummaryOutstandingCore
TempArray(Currenti, colSummaryTotalCoreSL) = "=R" & intRow & "C" & colSummaryInvoicedCoreSL & "+R" & intRow & "C" & colSummaryOutstandingCoreSL
TempArray(Currenti, colSummaryTotal3Party) = "=R" & intRow & "C" & colSummaryInvoiced3Party & "+R" & intRow & "C" & colSummaryOutstanding3Party
TempArray(Currenti, colSummaryTotal3PartySL) = "=R" & intRow & "C" & colSummaryInvoiced3PartySL & "+R" & intRow & "C" & colSummaryOutstanding3PartySL
TempArray(Currenti, colSummaryTotalProduct) = "=R" & intRow & "C" & colSummaryInvoicedProduct & "+R" & intRow & "C" & colSummaryOutstandingProduct
TempArray(Currenti, colSummaryTotalOther) = "=R" & intRow & "C" & colSummaryInvoicedOther & "+R" & intRow & "C" & colSummaryOutstandingOther
TempArray(Currenti, colSummaryTotalTotal) = "=R" & intRow & "C" & colSummaryInvoicedTotal & "+R" & intRow & "C" & colSummaryOutstandingTotal
Currenti = Currenti + 1
End With
intRow = intRow + 1
Next
Application.ScreenUpdating = False
Application.Calculate
Set Person = Nothing
TheRange.Value = TempArray
Dim RdoRange As Range
Dim ranges As Long
Set RdoRange = Selection.SpecialCells(Type:=xlFormulas)
For ranges = 1 To RdoRange.Areas.Count
RdoRange.Areas(ranges).Formula = _
Application.ConvertFormula _
(Formula:=RdoRange.Areas(ranges).Formula, _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlA1, ToAbsolute:=xlRelative)
Next ranges Application.ScreenUpdating = True
Bookmarks