xunda_gunda
New Member
- Joined
- Aug 17, 2012
- Messages
- 22
Hello,
I am trying to run simple macro but I get this error:
VBA Run-time error '-2147417848 (80010108)':
Method 'Range' of object '_Worksheet' failed
My procedure is following:
I just want that this code run in range mentioned above - "D15:D139".
What am I doing wrong?
Please help
I am trying to run simple macro but I get this error:
VBA Run-time error '-2147417848 (80010108)':
Method 'Range' of object '_Worksheet' failed
My procedure is following:
Rich (BB code):
Sub Fill_Empty_Cells_with_Formulas()
Application.ScreenUpdating = False
Dim rng As Range
Dim i As Long
Set rng = Workbooks("Book1").Worksheets(1).Range("D15:D139")
For Each cell In rng
If cell.Value = "" Then
cell.Offset(0, 0).Value = "=IF(ISTEXT(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4),TRUE)),"""",IF(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4),TRUE)<12,"""",IF(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4),TRUE)<=$D$8,"""",IF(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4),TRUE),-12,2)<>"""",MIN(OFFSET(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4),TRUE),-12,2),INDIRECT(ADDRESS(ROW()-1,COLUMN()+3,4),TRUE)),""""))))"
End If
Next
Application.OnTime Now + TimeValue("00:00:05"), "Fill_Empty_Cells_with_Formulas"
Application.ScreenUpdating = True
End Sub
I just want that this code run in range mentioned above - "D15:D139".
What am I doing wrong?
Please help
Last edited by a moderator: