+ Reply to Thread
Results 1 to 16 of 16

Run-time error '91' Object variable or with block variable not set please help me out

  1. #1
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Run-time error '91' Object variable or with block variable not set please help me out

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    What is lbl2? A label? Are you trying to get the contents in? It will be me.lbl2.caption if so.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    i am still getting the same error

    its label

    i am trying to get data

    see i have attached my sheet
    Attached Files Attached Files
    Last edited by baig123; 09-03-2014 at 06:02 AM. Reason: paragraph

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    Do you definitely have a control named 'lbl2'?

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    What data from a label? It only has caption

  6. #6
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    i have uploaded the user login details file

    in that userforms
    Last edited by baig123; 09-03-2014 at 06:17 AM. Reason: paragraph

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    The VBA project is locked.

  8. #8
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    sorry for that see this file
    Attached Files Attached Files

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    You haven't set ws to refer to any worksheet.

  10. #10
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    i am trying submiit data to my excelsheet called(workstation.xlsx)

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    You have this in the code but obviously it's commented out.
    Please Login or Register  to view this content.
    Try uncommenting, and if needed change 'Login Time' to the required sheet.

  12. #12
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    now i am getting

    subscript out of range

    'Set ws = Worksheets("Login Time")
    Last edited by baig123; 09-03-2014 at 07:08 AM. Reason: paragraph

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    That's because there is no worksheet 'Login Time' in the workbook.

    You need to use a worksheet that is actually in the workbook.

  14. #14
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    you dont seem to have a sheet of that name!!!!

  15. #15
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    that sheet name it is in workstation.xlsx
    Attached Files Attached Files

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run-time error '91' Object variable or with block variable not set please help me out

    That's the workbook name.

+ 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. Replies: 0
    Last Post: 04-16-2013, 07:15 AM
  2. [SOLVED] Run-time error '91': Object variable or With block variable not set
    By msawyer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-08-2013, 03:27 PM
  3. Replies: 6
    Last Post: 12-21-2012, 08:03 AM
  4. Replies: 1
    Last Post: 09-25-2012, 08:03 PM
  5. [SOLVED] Intermittent Run-time Error 91: Object Variable or With Block variable not set
    By fraanchtoast in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-29-2012, 10:11 AM

Tags for this Thread

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