pass parm to another userform

L

Leslie

I am new to excel programming and stuggling to come up with the proper syntax
for passing my rownumber to another userform.

I have one user form where I have code for navigating through the rows on my
spreadsheet. I have a button on my main form called "Additional Lines".
When this button is clicked, I have the following code.

These variable are declared up top:
Public myrow as Variant
Public r as Long

Private Sub cmdAdditionalLines()
myrow = r
frmAdditionalLines.show vbModal
End Sub

Does anyone know what the syntax is pass "myrow" parm and show user form?
 
B

Bob Phillips

That is the syntax, just access it via

FirstFormName.r

form frmAdditionalLines
 
S

Susan

IMHO you would be better off using one userform and using a multipage
control on it. then you could hide whichever pages you don't want
seen at any given time, and your variable would already be set and
active.

Private Sub cmdAdditionalLines()
myrow = r
pgAdditionalLines.visible=true
End Sub

just an idea
:)
susan
 
L

Leslie

Thank you! Worked great

Bob Phillips said:
That is the syntax, just access it via

FirstFormName.r

form frmAdditionalLines

--
__________________________________
HTH

Bob
 
L

Leslie

Thanks Susan, I will remember this next time. For now, I went with Bob's
answer. I would have to re-design form to do the multipage way. I have
already spent too much time on this project. I've been writing access
applications for years, but I've never had to use vba code in excel. I'll
probably be posting some more questions on this before it's over.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top