+ Reply to Thread
Results 1 to 7 of 7

error 400 - Label not defined help

Hybrid View

Scoobster_doo error 400 - Label not defined... 04-11-2017, 09:39 AM
zbor Re: error 400 - Label not... 04-11-2017, 09:40 AM
Scoobster_doo Re: error 400 - Label not... 04-11-2017, 09:50 AM
mikerickson Re: error 400 - Label not... 04-11-2017, 09:47 AM
zbor Re: error 400 - Label not... 04-11-2017, 09:50 AM
Scoobster_doo Re: error 400 - Label not... 04-11-2017, 09:48 AM
Scoobster_doo Re: error 400 - Label not... 04-11-2017, 09:55 AM
  1. #1
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Durham
    MS-Off Ver
    2013
    Posts
    126

    error 400 - Label not defined help

    Hi Guys,

    I kept getting an error 400 so I threw in a trap and it come sup with 'Label not defined' I cannot for the life of me figure out why! Any ideas would be great.

    
    Sub CollectIndexData()
    Dim HouseTypeName() As Variant
    
    
    
    
    '---------->>>>>>>>>> Collect Data First <<<<<<<<<<----------
    
    
    TheEstateID = EOV.Cells(4, 4)      'Estate File Name
    TheEstateName = EOV.Cells(6, 4)             'Estate Name
    TheLocality = EOV.Cells(4, 10)                   'Locality ID
    TheBA = EOV.Cells(6, 10)                           'Billing Authority
    TheCreatedDate = EOV.Cells(16, 11)         'File Created
    TheCompletedDate = EOV.Cells(18, 10)    'File Completed
    
    'Developer Index Data---------------------------------------------------
    'TheDeveloperData(1) = The Unique ID from the index
    TheDeveloperData(2) = EOV.Cells(8, 4) 'Developer Name
    TheDeveloperData(3) = EOV.Cells(9, 4) 'Developer Website
    
    'Type Index-----------------------------------------------------------------
    
    Set TheSheet = ThisWorkbook.Sheets("House Types")
    HouseTypeLastRow = DataSetLastRow(TheSheet)
    
    If HouseTypeLastRow > 4 Then
    HouseTypeName() = TheSheet.Range(Cells(5, 2), Cells(LastRow, 2)) <------- error 400 occurs here, then if blanked out it goes to the next line
    TypeDeveloper() = TheSheet.Range(Cells(5, 3), Cells(LastRow, 3))
    TheBand() = TheSheet.Range(Cells(5, 4), Cells(LastRow, 4))
    'EstateID() EstateID
    'ThePAD() = TheSheet.Range(Cells(5, 5), Cells(LastRow, 19))
    End If
    
    p.s. DataSetLastRow is a defined function so that should be fine
    
    End Sub
    Thanks in advance

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,062

    Re: error 400 - Label not defined help

    You need also to define Cells to that sheet:

    HouseTypeName() = TheSheet.Range(TheSheet.Cells(5, 2), TheSheet.Cells(LastRow, 2))
    Same for all other Cells.

    Also, I don't see that you've defined LastRow so maybe it's a 0 and there is no Cell(0,4)

  3. #3
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Durham
    MS-Off Ver
    2013
    Posts
    126

    Re: error 400 - Label not defined help

    @ Mick

    Tbh me too - although prior to this it hasn't caused issues so for some reason it seems to be fine with it.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: error 400 - Label not defined help

    I'm surprised that the () without index isn't causing a syntax error
    HouseTypeName() = TheSheet.Range(Cells(5, 2), Cells(LastRow, 2))
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,062

    Re: error 400 - Label not defined help

    Quote Originally Posted by mikerickson View Post
    I'm surprised that the () without index isn't causing a syntax error
    HouseTypeName() = TheSheet.Range(Cells(5, 2), Cells(LastRow, 2))
    That too

  6. #6
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Durham
    MS-Off Ver
    2013
    Posts
    126

    Re: error 400 - Label not defined help

    Having definined 'TheSheet.Cells' it still comes up with the error, although 'TheSheet' must be fine as when I highlight Cells(5. 2) in debug it indicates it's populated with the correct info.

    I shall look into the Last Row issue now and see if that's the problem,

    Thanks!

  7. #7
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Durham
    MS-Off Ver
    2013
    Posts
    126

    Re: error 400 - Label not defined help

    Haha both comments were spot on!

    @ Zbor - The LastRow name should have been HouseTypelastrow as that's what I'd set it is - Normally I just use LastRow
    @Mick - The () didn't cause a syntax but type mismatch once the initial label error was solved - sorted!

    Both thanks for your help

    +Rep all around!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Error message: Run-Time error '1004 '; application-defined or object-defined error
    By Davasu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2015, 06:52 AM
  2. Replies: 1
    Last Post: 10-22-2015, 05:50 AM
  3. error handler label not defined.
    By Rob K in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-17-2015, 09:27 AM
  4. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  5. [SOLVED] Error " Run-time error '1004': application defined or object defined error
    By lengwer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2013, 07:26 AM
  6. [SOLVED] Run Time 1004 - App Defined or Object defined error with String defined path structure
    By sarails in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2012, 09:38 PM
  7. [SOLVED] Macro error - Run time error 1004 (App defined/Object Defined error)
    By jlax34 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2012, 03:02 PM

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