+ Reply to Thread
Results 1 to 2 of 2

Application-defined or object-defined error Please Help

Hybrid View

  1. #1

    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. #2
    Toppers
    Guest

    RE: 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

    "[email protected]" 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1