Hi Sunil Dushila,
See the attached file which uses a slightly different approach, that does not require the use of auxiliary 'Sheet1.' I hope this does not confuse the issue.
UserForm1 code module code:
Ordinary Code module code such as module Module1 or ModUserForm1:
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
This option requires all variables to be declared and will give a compiler error for undeclared variables.
Lewis
Bookmarks