Let me make sure I understand your question. Sheet1 has a checkbox called Pbox and a textbox called Banname. If Pbox is checked, then you want the value from Banname to be copied to a cell on Sheet4. Your code does that. What exactly is the problem you are having with this code?
Where is this code located? Is this in a UserForm? Your description talks about a checkbox on a worksheet, but the code refers to unloading a UserForm. Can you clarify what controls are where, and what modules contain the code?
This is not the source of your problem but you are using With statements but not taking advantage of them in the code. A With allows you to omit the qualification of an object. For example, you are using With but still explicitly qualifying references to Sheet4 objects:
but the With allows you to remove those qualifications:
Wherever you have an expression starting with a dot, VBA will use the qualification from the With statement before the dot.
However, that doesn't mean your code won't work, it just means that the With doesn't do anything.
Bookmarks