Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Application-defined or object-defined error Please Help

I am new to amcro writing in excel and when run follwoing code i am
gettin Application-defined or object-defined error. Please help me .
how can i achive this?

Sub Loop8()
' This loop does the calculating itself and writes the result into each
cell
Range("D1").Select
Do
If IsEmpty(ActiveCell.Offset(0, -1)) Then
ActiveCell.Value = 0
ActiveCell.Offset(0, -1).Value = "Customer"
ElseIf ActiveCell.Offset(0, -1).Value = ActiveCell.Offset(-1,
-1).Value Then
ActiveCell.Value = 0
Else
ActiveCell.Value = ActiveCell.Offset(0, -2).Value -
ActiveCell.Offset(0, -3).Value
End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, -2))



End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
Toppers
 
Posts: n/a
Default Application-defined or object-defined error Please Help

Hi,
You didn't say which line caused the error but the following will
error if
D1 is not Empty as you test for Offset(-1,-1) which will give a row value of
0 (if activecell is on row 1) which is invalid.


ElseIf ActiveCell.Offset(0, -1).Value = ActiveCell.Offset(-1, -1).Value Then


HTH

" wrote:

I am new to amcro writing in excel and when run follwoing code i am
gettin Application-defined or object-defined error. Please help me .
how can i achive this?

Sub Loop8()
' This loop does the calculating itself and writes the result into each
cell
Range("D1").Select
Do
If IsEmpty(ActiveCell.Offset(0, -1)) Then
ActiveCell.Value = 0
ActiveCell.Offset(0, -1).Value = "Customer"
ElseIf ActiveCell.Offset(0, -1).Value = ActiveCell.Offset(-1,
-1).Value Then
ActiveCell.Value = 0
Else
ActiveCell.Value = ActiveCell.Offset(0, -2).Value -
ActiveCell.Offset(0, -3).Value
End If
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, -2))



End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SET statement tutorial Daminc Excel Discussion (Misc queries) 13 January 17th 06 04:47 PM
Creating a Powerpoint object (in XP onwards) with an ActiveWindow BizMark Excel Discussion (Misc queries) 0 August 12th 05 12:46 PM
Cannot start the source application for this object oil_driller Excel Discussion (Misc queries) 1 March 3rd 05 03:41 PM
VBA: Where to find Excel Object model? N. Foldager Excel Discussion (Misc queries) 13 February 6th 05 06:43 PM
Cannot start the source application for this object Excel General Questions Excel Discussion (Misc queries) 0 February 2nd 05 07:05 PM


All times are GMT +1. The time now is 08:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"