+ Reply to Thread
Results 1 to 2 of 2

ERROR object variable or with block variable not set

  1. #1
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    ERROR object variable or with block variable not set

    In a userform I have two boxes with dates DEL_BEG AND DEL_END, which are basically a range of dates.

    When I click "add" of the userform to add the new record, I made following code to:

    - open workbook planning
    - find DEL_BEG and DEL_END, merge the specific range and insert certain type of datas.

    it works good when the month of DEL_BEG and DEL_END is the same (ex: DEL_BEG = 28-Jun-16 and DEL_END = 30-Jun-16) - here below the code from my userform

    Please Login or Register  to view this content.


    But when DEL_BEG and DEL_END does not concern the same month (ex: DEL_BEG = 28-Jun-16 and DEL_END = 02-Jul-16), my code is supposed to:

    - open the workbook,

    - find DEL_BEG (=zone = 28-Jun-16) and last day of the DEL_BEG month (=zone2 = 30-Jun-16), merge the range and insert some data (here below the code)

    Please Login or Register  to view this content.
    - then the code should find DEL_END (=zone1= 02-Jul-16), but if DEL_END is not the 1st day of the month, then it should find the 1st day of the month(=zone3=01-Jul-16), then DEL_END, merge the range bla bla. Here I got a message error "object variable or with block variable not set" in the first "cells.find"

    Please Login or Register  to view this content.

    can someone explain to me where is the mistake? Here attached the file "planning2016" and the one with userform "example" if it can help.......

    Many thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Re: ERROR object variable or with block variable not set

    I solved the problem defining correctly the ranges, the string etc.

    However when the del_beg and del_end are not in the same month, when I try to find "zone3" the .find method returns nothing.....

    Pls find here attached amended files
    Attached Files Attached Files

+ 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] Run-time error '91': Object variable or With block variable not set when closing userform
    By bishoposiris in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2016, 08:59 AM
  2. Replies: 2
    Last Post: 08-22-2014, 03:55 AM
  3. Replies: 0
    Last Post: 04-16-2013, 07:15 AM
  4. Replies: 6
    Last Post: 12-21-2012, 08:03 AM
  5. Replies: 1
    Last Post: 09-25-2012, 08:03 PM
  6. 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
  7. Find Method error: -Object variable with block set variable not set
    By bambino_32 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-02-2010, 01:18 AM

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