Dear Forum Members
Can you nest With......End With clauses.
I want to populate a userform from a worksheet and would like to code
but I can'tPlease Login or Register to view this content.
Can someone please help?
John
Dear Forum Members
Can you nest With......End With clauses.
I want to populate a userform from a worksheet and would like to code
but I can'tPlease Login or Register to view this content.
Can someone please help?
John
Last edited by j_Southern; 02-11-2011 at 09:35 AM.
Hi,
Not with the effect you want. The innermost "With Object" will be applied by the compiler so, in this case, it will interpret TextBox1 belong to Sheet1 and not Userform1.
Colin Legg
Ah well, I,ll just have to continue typing. Thanks for your help though it stops me from fruitlessly searching.
John
Of course, one thing you can do (and it helps if you have to make amendments to the sheet name your code because you only have to do it in one point), is hold a reference to the object in a variable.
eg.
Instead of this:
Please Login or Register to view this content.
You could use this:
And then you could introduce your With.... End With block if you wanted to (I wouldn't in this case):Please Login or Register to view this content.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks