+ Reply to Thread
Results 1 to 11 of 11

Run Time Error '94' Invalid use of null

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362

    Run Time Error '94' Invalid use of null

    hi again,

    I am receiving the error message Run Time Error '94' Invalid use of null when running my program.

    here is the code where the error is being caused:
    Private Sub UserForm_Initialize()
        Dim stSheetName As String
        Const DATE_RANGE As String = "G10:G100"
        Const TITLE_RANGE As String = "h10:h100"
        Const TIME_RANGE As String = "i10:i100"
        stSheetName = Worksheets("Database").Name
        Set Mydata = Worksheets("Database").Range("A1").CurrentRegion   'database
        UserIDTextBox.SetFocus
        lbldate.Caption = Range(DATE_RANGE).Text
        lbltitle.Caption = Range(TITLE_RANGE).Text
        lbltime.Caption = Range(TIME_RANGE).Text
    
            
    End Sub
    thanks,

    stoey

  2. #2
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    The error generally mean that you are trying to use an object / item which is not defined..


    Might be you text box name is spelt differently and you are trying to call it by different spelling


    If you can post the workbook , we can try to find the error

  3. #3
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362
    here's the sample workbook requested
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You are tring to load data from 90 cells into one label, most of which are empty so there is nothing to display.

    Why are you doing this?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    error is in this part of code



       Const DATE_RANGE As String = "g10:g10"
        Const TITLE_RANGE As String = "h10:h100"
        Const TIME_RANGE As String = "i10:i100"
    in the first line you have defined a range G10:G100... which will have 90 different values..

    And in the below code u are calling that 90 values in one text box .. which is not possible...


    try modifying the above code to
    "G10:G10" " , "h10:h10" and "i10:i10"

        lbldate.Caption = Range(DATE_RANGE).Text
        lbltitle.Caption = Range(TITLE_RANGE).Text
        lbltime.Caption = Range(TIME_RANGE).Text

  6. #6
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362
    hi,

    to answer roy's question:
    You are tring to load data from 90 cells into one label, most of which are empty so there is nothing to display.

    Why are you doing this?
    i would like to display the training,time and date using label on a userform. So if a user enters the training, time and date title on any of the cells on that column, the values will still appear on the userform. any suggestions you have to improve this?

    question to Shijesh,
    will the values entered in any of those cells under the training,time and date be displayed still on the userform?

  7. #7
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    Quote Originally Posted by stoey View Post
    question to Shijesh,
    will the values entered in any of those cells under the training,time and date be displayed still on the userform?

    Hi stoey,

    Values will still be displayed.

+ 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