Results 1 to 3 of 3

Worksheet: Object variable or With block variable not set?

Threaded View

  1. #1
    Registered User
    Join Date
    11-28-2013
    Location
    United States
    MS-Off Ver
    2013
    Posts
    3

    Question Worksheet: Object variable or With block variable not set?

    I am getting "Run-time error '91': Object variable or With block variable not set" on the marked line:

    Dim oFCWS As Worksheet
    Set oFCWS = Worksheets.Item("Flashcard Practice")
    tValueToFind = oFCWS.Range("B4").Value
    
    Dim oWStoSearch As Worksheet
    Set oWStoSearch = Worksheets.Item(oFCWS.Range("B3").Value)
    
    Dim rAllCells As Range
    rAllCells = oWStoSearch.Cells          '*** ERROR LINE ***
    Dim rCell As Range
    rCell = rAllCells.Find(What:=tValueToFind, After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext)
    It seems that my types are right, and that oWStoSearch specifies a unique worksheet. Even so, if it wants an object for oWStoSearch to dereference, I'm not sure how to do that. What am I doing wrong?
    Last edited by Fotis1991; 11-28-2013 at 10:59 AM. Reason: Pls use code tags as per forum rules

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel VBA error code 91: Object variable or with block variable not set
    By wilnexpc in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-24-2013, 11:46 AM
  2. Replies: 4
    Last Post: 07-12-2013, 12:14 PM
  3. Replies: 6
    Last Post: 12-21-2012, 08:03 AM
  4. Replies: 1
    Last Post: 09-07-2012, 12:08 AM
  5. Object Variable or With Block Variable Not Set- Error on Another User Machine
    By dailem in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2010, 09:28 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