In the line:
Sheets("Sheet1").range(What3).Copy , Range() requires an address, it cannot be empty. Therefore you must modify your code to handle conditions where what3 & 4 are missing. You can use an IF..Then condition or, you could use an ON ERROR RESUME NEXT before those two lines.
In your second example:
You are using Cel2 three different times. The function (as posted) never uses Cel3 & 4.
If you had:
And called it with:
The last two lines would error out because, again you would have .Range("")
Bookmarks