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
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)
- 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"
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.
Bookmarks