bradh_nz
08-23-2007, 07:40 AM
I currently have this loop working however if I try to get it to select multiple ranges it errors, any ideas
ie need this
Range("G6:W79,Z6:AD79").Select For Each C In Selection.Cells
Sub Insert_Formulas()
Dim C As Range
'Loop format pivot table borders
Range("H8:L32").Select For Each C In Selection.Cells
C.FormulaR1C1 = "=VLOOKUP(R5C,INDIRECT.EXT(""'""&RC5),3,FALSE)"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Interior.ColorIndex = 15
Next C
End Sub
ie need this
Range("G6:W79,Z6:AD79").Select For Each C In Selection.Cells
Sub Insert_Formulas()
Dim C As Range
'Loop format pivot table borders
Range("H8:L32").Select For Each C In Selection.Cells
C.FormulaR1C1 = "=VLOOKUP(R5C,INDIRECT.EXT(""'""&RC5),3,FALSE)"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Interior.ColorIndex = 15
Next C
End Sub