Well thank you all. but let me please give you an example of what i'm doing hopefully it'll be clearer to you (i'm still a beginner in VBA)
i have a sheet that looks like this:
the first cells (A1, A2,...) are filled with data i'm not intersted in (this varies from 4 to 7 lines in general. then there's an empty line and then comes my table. here's the macro i have so far that does a small calculation first and then has to ouptut a pivot table respecting a specific format (but this is ok, i'll deal with it).
Sub Macro8()
Cells(1, 2).Select
Selection.End(xlDown).Select
Cells.Find(What:="Opty Prod Net Extended Price", After:=ActiveCell, LookIn _
:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Next.Activate
ActiveCell.FormulaR1C1 = "Total Opty Revenue"
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=0,RC[-2]+RC[-3],rc[-1])"
While Not ActiveCell.Offset(1, -1).Value = ""
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]=0,RC[-2]+RC[-3],rc[-1])"
Wend
End Function
Hope you'll be able to help me out with this.
Regards,
Adnane