That is fantastic! thank you!
one more question:
i'm finding the same problem with copying the formulas that i insert. for example, the code below describes the three formulas i insert. i type the formula in the first cell and double-click to auto fill the formula down to the last cell. you can see that repeated three times below.
example:
Selection.AutoFill Destination:=Range("F3:F4138")
again it specifies a range. can i use the same piece of code you provided above to copy the formula in any size XML file? otherwise when i move from a large file to one with fewer rows the formula extends far below the new XML.
Sub CopyFormulasSort1()
'
' CopyFormulasSort1 Macro
' Macro recorded 6/4/2009 by CCE User
'
'
Range("F3").Select
ActiveCell.FormulaR1C1 = _
"=IF(AND(RC[-5]=R[-1]C[-5],RC[-2]<R[-1]C[-2]),RC[-2]+1,RC[-2])"
Range("F3").Select
Selection.AutoFill Destination:=Range("F3:F4138")
Range("F3:F4138").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("G3").Select
ActiveCell.FormulaR1C1 = _
"=IF(AND(RC[-6]=R[-1]C[-6],RC[5]=R[-1]C[5],R[-1]C[-3]>RC[-3]),RC[-3]+1,IF(AND(RC[-6]=R[-1]C[-6],RC[5]=R[-1]C[5],R[-1]C<>R[-1]C[-3]),RC[-3]+1,RC[-3]))"
Range("G3").Select
Selection.AutoFill Destination:=Range("G3:G4138")
Range("G3:G4138").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("H3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-7]<>R[-1]C[-7],RC[-4]+RC[-3],RC[-1]+RC[-3])"
Range("H3").Select
Selection.AutoFill Destination:=Range("H3:H4138")
Range("H3:H4138").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A2").Select
End Sub
Bookmarks