+ Reply to Thread
Results 1 to 2 of 2

Application defined or Object defined error

Hybrid View

  1. #1
    Registered User
    Join Date
    08-22-2011
    Location
    Los Angele, California
    MS-Off Ver
    Excel 2003
    Posts
    2

    Application defined or Object defined error

    I have been looking all over for something that you help explain what I am doing, but I can't seem to find anything that helps so maybe someone can tell me exactly that I am doing wrong,

    
    
    Option Explicit
    
    Public AccessLastRow, AmexLastRow, OthersLastRow, test As Variant
    Public AccessParent As Integer
    
    
    Sub Main()
    
    Call Initialize
    Call SetFormulaConditions
    Call UseFormulas
    
    Call Finalize
    
    End Sub
    
    Sub Initialize()
    
    
    Range("AccessLastRow") = Sheets("Access").UsedRange.Rows.Count - Range("AccessDateAnchor").Row + 1
    
    Range("AMEXLastrow") = Sheets("AMEX").UsedRange.Rows.Count - Range("AccessDateAnchor").Row
    Range("OthersLastRow") = Sheets("Others").UsedRange.Rows.Count - Range("OthersDateAnchor").Row
    
    
    
    'AccessLastRow = Range("AccessLastRow")
    'AmexLastRow = Range("AmexLastRow")
    'OthersLastRow = Range("OthersLastRow")
    
    
    End Sub
    Sub SetFormulaConditions()
    
    Sheets("Access").Select
    
    'Access
    
    Range(Cells(Range("AccessParent").Row, Range("AccessParent").Column).Resize(AccessLastRow, 1)) = "AccessParents"
    Range(Cells(Range("AccessBill").Row, Range("AccessBill").Column).Resize(AccessLastRow, 1)).Name = "Access"
    
    Range("AccessParents").Formula = "=Sum(H10:M10)"
    
    'AMEX
    
    Sheets("AMEX").Select
    Cells(Range("AMEXInvoice").Row, Range("AMEXInvoice").Column).Resize(AmexLastRow, 1).Name = "AMEXInvoice"
    Cells(Range("AmexAmount").Row, Range("AmexAmount").Column).Resize(AmexLastRow, 1).Name = "AMEX"

    I am getting the error Application defined or Object defined error from this particular line of code:

    Range(Cells(Range("AccessParent").Row, Range("AccessParent").Column).Resize(AccessLastRow, 1)) = "AccessParents"
    Any ideas will help, thanks in advance!

    - JP

  2. #2
    Registered User
    Join Date
    08-22-2011
    Location
    Los Angele, California
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Application defined or Object defined error

    Nvm I was able to fix the issue. All that needed to be done is have the information brought down into the other sub (sorry, I have only been coding for 6 days so I don't know the names, just how to do things)

    Sub SetFormulaConditions()
    
    AccessLastRow = Range("AccessLastRow")
    AmexLastRow = Range("AmexLastRow")
    OthersLastRow = Range("OthersLastRow")
    
    Cells(Range("AccessParent").Row, Range("AccessParent").Column).Resize(AccessLastRow, 1)) = "AccessParents"
    
    End Sub
    and then it ran through it. I'll leave this up just in case someone has the same problem.

+ 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