Can I have 2 user forms that relate to the same worksheet

  • Thread starter Thread starter ButterflyGirl
  • Start date Start date
B

ButterflyGirl

Hi & thanks in advance,
I am trying to put 2 user forms that relate to the same worksheet, however
its not working...
I am getting an error message that says "Compile error: Invalid or
unqualified reference"
I am extremely new to programming so i would appreciate any help I can
get... I can email the "code" through if that helps.
 
After 2 days of searching I actually found the answer myself!!! :-)
I left the _ (underscore) off the end of the 1st row & obviously this makes
a difference as to how the code is handled. Please explain why? But it is
now working perfectly.


lRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
 
It is actually a single line of code.

lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

_ is used as a line break; incase your code line is lenghty you can use a
space and underscore to break that to multiple lines.....

If this post helps click Yes
 
Back
Top