Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formula in a cell (in Visual Basic)
Can somebody understand why my program does not work ?
I have tried to put Cells, :, and so on but it does not work. Private Sub Moy() Dim Line As Integer Line = 16 While Worksheets(1).Cells(Line, 13).Value < "" Worksheets(1).Cells(Line, 16).Formula = "=Average(Cells((Line,13),(Line,15)))" Line = Line + 1 Wend End Sub Thank you in advance for the answer, Jean-michel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formula in a cell (in Visual Basic)
Try this:
Sub Moy() Dim Line As Integer Line = 16 While Worksheets(1).Cells(Line, 13).Value < "" Worksheets(1).Cells(Line, 16).FormulaR1C1 = "=AVERAGE(RC[-3]:RC[-1])" Line = Line + 1 Wend End Sub RBS "imej-clavier" wrote in message ... Can somebody understand why my program does not work ? I have tried to put Cells, :, and so on but it does not work. Private Sub Moy() Dim Line As Integer Line = 16 While Worksheets(1).Cells(Line, 13).Value < "" Worksheets(1).Cells(Line, 16).Formula = "=Average(Cells((Line,13),(Line,15)))" Line = Line + 1 Wend End Sub Thank you in advance for the answer, Jean-michel |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formula in a cell (in Visual Basic)
Private Sub Moy()
Dim Line As Integer Line = 16 While Worksheets(1).Cells(Line, 13).Value < "" Worksheets(1).Cells(Line, 16).Formula = "=Average(M" & Line & ":O" & Line & ")" Line = Line + 1 Wend End Sub -- HTH RP (remove nothere from the email address if mailing direct) "imej-clavier" wrote in message ... Can somebody understand why my program does not work ? I have tried to put Cells, :, and so on but it does not work. Private Sub Moy() Dim Line As Integer Line = 16 While Worksheets(1).Cells(Line, 13).Value < "" Worksheets(1).Cells(Line, 16).Formula = "=Average(Cells((Line,13),(Line,15)))" Line = Line + 1 Wend End Sub Thank you in advance for the answer, Jean-michel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic insert formula | Excel Discussion (Misc queries) | |||
Adding a dymanic formula to a cell using visual basic | Excel Discussion (Misc queries) | |||
Adding a dymanic formula to a cell using visual basic | Excel Discussion (Misc queries) | |||
Visual basic Check Box and the IF formula | Excel Discussion (Misc queries) | |||
Formula in Visual Basic For Excel | Excel Discussion (Misc queries) |