Hi All, I am working on a document where I want to sort some data, which copies data from one worksheet to another, applies some formulas to cells, and then I want to sort the data by column A, from low to high. I got it working at some point (used the Macro recorder), but I want to apply the same kind of filter to the next two adjacent columns. After I copied and modified the code to the next location, I started getting intermittent Runtime 1004 errors, or the code is not working. I can't figure out why.
The code is:
...any suggestions?
The code is:
VBA Code:
shAllPositions.Range("B2:B722").FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC[-1],ImportData!R2C2:R39C3,2,FALSE)),"""",VLOOKUP(RC[-1],ImportData!R2C2:R39C3,2,FALSE))"
shAllPositions.Range("B2:B722").Value = shAllPositions.Range("B2:B722").Value
shAllPositions.Range("A2") = Round(shDataImport.Range("B40"), 0)
shAllPositions.Range("A3:A722").FormulaR1C1 = "=IF(R[-1]C+1=720,1,R[-1]C+1)"
shAllPositions.Range("A3:A722").Value = shAllPositions.Range("A3:A722").Value
shAllPositions.Range("A2:A722").NumberFormat = "0"
With shAllPositions.Sort
.SetRange Range("A1:B722")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
...any suggestions?