Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Was trying to write a macro to insert a formula in a range of cells. The last cell is calculated using the function Lastrow. However when i run it, I get the following error: "Application-defined or Object-defined error" This is the macro. Sub Max_range_calc() ' Keyboard Shortcut: Ctrl+Shift+M Dim i, k As Integer k = LastRow(7) For i = 1 To k Cells(i, 7).FormulaR1C1 = "=(RC[-2]-RC[-3])/RC[-1]" Next i End Sub Function LastRow(C) R = 10000 'set R to be greater than your maxim row number Do If (Cells(R, C)) < "" Then Exit Do Else R = R - 1 Loop LastRow = R End Function Please Help!!! Thanks a bunch Priyanka |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run-time error '50290': Application-defined or object-defined erro | Excel Discussion (Misc queries) | |||
Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error; | Excel Programming | |||
Copying A Range of Cells From one Sheet to Another - Error Application Defined or Object Defined | Excel Programming | |||
Runtime error 1004- application defined or object defined erro | Excel Programming | |||
Runtime error 1004- application defined or object defined erro | Excel Programming |