+ Reply to Thread
Results 1 to 12 of 12

Public, Private, Event modules, Forms modules,,,

  1. #1
    Jim May
    Guest

    Public, Private, Event modules, Forms modules,,,

    Theis is probably simple, but not to me (at this point)...

    If I assign a value (an integer, say 5) to a variable "mySeq" while in an
    Event module, say sheet1 and I need to "use it" immediately in Command
    button Click event
    of a Form frmPOReqEdit, how would I do that?
    TIA



  2. #2
    Tom Ogilvy
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    assume it is typed/declared at the top of the sheet1 (code name) module
    outside any procedures

    Public MySeq

    then in the userform.

    v = Sheet1!MySeq

    --
    Regards,
    Tom Ogilvy

    "Jim May" <jmay@cox.net> wrote in message
    news:qzc9f.35503$OM4.8753@dukeread06...
    > Theis is probably simple, but not to me (at this point)...
    >
    > If I assign a value (an integer, say 5) to a variable "mySeq" while in an
    > Event module, say sheet1 and I need to "use it" immediately in Command
    > button Click event
    > of a Form frmPOReqEdit, how would I do that?
    > TIA
    >
    >




  3. #3
    Chip Pearson
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    > v = Sheet1!MySeq

    Should be Sheet1.MySeq


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    > assume it is typed/declared at the top of the sheet1 (code
    > name) module
    > outside any procedures
    >
    > Public MySeq
    >
    > then in the userform.
    >
    > v = Sheet1!MySeq
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Jim May" <jmay@cox.net> wrote in message
    > news:qzc9f.35503$OM4.8753@dukeread06...
    >> Theis is probably simple, but not to me (at this point)...
    >>
    >> If I assign a value (an integer, say 5) to a variable "mySeq"
    >> while in an
    >> Event module, say sheet1 and I need to "use it" immediately in
    >> Command
    >> button Click event
    >> of a Form frmPOReqEdit, how would I do that?
    >> TIA
    >>
    >>

    >
    >




  4. #4
    Jim May
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    I think I did as you said, but now I'm getting
    R/T 438 - Obj doesn't support this prop or meth..

    After clicking Debug I'm taken to my user module code
    window with highlite covering:
    CurrRowNo = Sheet2!MySeq

    Any thoughts on what I might try to fix?
    TIA,
    Jim

    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    > assume it is typed/declared at the top of the sheet1 (code name) module
    > outside any procedures
    >
    > Public MySeq
    >
    > then in the userform.
    >
    > v = Sheet1!MySeq
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Jim May" <jmay@cox.net> wrote in message
    > news:qzc9f.35503$OM4.8753@dukeread06...
    >> Theis is probably simple, but not to me (at this point)...
    >>
    >> If I assign a value (an integer, say 5) to a variable "mySeq" while in an
    >> Event module, say sheet1 and I need to "use it" immediately in Command
    >> button Click event
    >> of a Form frmPOReqEdit, how would I do that?
    >> TIA
    >>
    >>

    >
    >




  5. #5
    Chip Pearson
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    Tom's post had a typo: an exclamation mark where there should
    have been a period.

    Use
    CurrRowNo = Sheet2.MySeq


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Jim May" <jmay@cox.net> wrote in message
    news:sae9f.35513$OM4.33041@dukeread06...
    >I think I did as you said, but now I'm getting
    > R/T 438 - Obj doesn't support this prop or meth..
    >
    > After clicking Debug I'm taken to my user module code
    > window with highlite covering:
    > CurrRowNo = Sheet2!MySeq
    >
    > Any thoughts on what I might try to fix?
    > TIA,
    > Jim
    >
    > "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    > news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    >> assume it is typed/declared at the top of the sheet1 (code
    >> name) module
    >> outside any procedures
    >>
    >> Public MySeq
    >>
    >> then in the userform.
    >>
    >> v = Sheet1!MySeq
    >>
    >> --
    >> Regards,
    >> Tom Ogilvy
    >>
    >> "Jim May" <jmay@cox.net> wrote in message
    >> news:qzc9f.35503$OM4.8753@dukeread06...
    >>> Theis is probably simple, but not to me (at this point)...
    >>>
    >>> If I assign a value (an integer, say 5) to a variable "mySeq"
    >>> while in an
    >>> Event module, say sheet1 and I need to "use it" immediately
    >>> in Command
    >>> button Click event
    >>> of a Form frmPOReqEdit, how would I do that?
    >>> TIA
    >>>
    >>>

    >>
    >>

    >
    >




  6. #6
    Jim May
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    Yes, thanks, that got me PAST that Line, however I'm
    now stopped at the next line with R/T 1004 App...
    Holding the cursor over Sheet2.MySeq reads "EMPTY",
    probably why it is bombing..
    hummmm..
    Appreciate your help.
    Jim

    "Chip Pearson" <chip@cpearson.com> wrote in message
    news:uQkddlb3FHA.3900@TK2MSFTNGP12.phx.gbl...
    > Tom's post had a typo: an exclamation mark where there should have been a
    > period.
    >
    > Use
    > CurrRowNo = Sheet2.MySeq
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    > "Jim May" <jmay@cox.net> wrote in message
    > news:sae9f.35513$OM4.33041@dukeread06...
    >>I think I did as you said, but now I'm getting
    >> R/T 438 - Obj doesn't support this prop or meth..
    >>
    >> After clicking Debug I'm taken to my user module code
    >> window with highlite covering:
    >> CurrRowNo = Sheet2!MySeq
    >>
    >> Any thoughts on what I might try to fix?
    >> TIA,
    >> Jim
    >>
    >> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    >> news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    >>> assume it is typed/declared at the top of the sheet1 (code name) module
    >>> outside any procedures
    >>>
    >>> Public MySeq
    >>>
    >>> then in the userform.
    >>>
    >>> v = Sheet1!MySeq
    >>>
    >>> --
    >>> Regards,
    >>> Tom Ogilvy
    >>>
    >>> "Jim May" <jmay@cox.net> wrote in message
    >>> news:qzc9f.35503$OM4.8753@dukeread06...
    >>>> Theis is probably simple, but not to me (at this point)...
    >>>>
    >>>> If I assign a value (an integer, say 5) to a variable "mySeq" while in
    >>>> an
    >>>> Event module, say sheet1 and I need to "use it" immediately in Command
    >>>> button Click event
    >>>> of a Form frmPOReqEdit, how would I do that?
    >>>> TIA
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >




  7. #7
    Jim May
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    MySeq is created in a Before Double-Click Event
    which after performing certain code ends with
    Cancel = True;
    Does that matter?
    Jim

    "Jim May" <jmay@cox.net> wrote in message
    news:kte9f.35525$OM4.16202@dukeread06...
    > Yes, thanks, that got me PAST that Line, however I'm
    > now stopped at the next line with R/T 1004 App...
    > Holding the cursor over Sheet2.MySeq reads "EMPTY",
    > probably why it is bombing..
    > hummmm..
    > Appreciate your help.
    > Jim
    >
    > "Chip Pearson" <chip@cpearson.com> wrote in message
    > news:uQkddlb3FHA.3900@TK2MSFTNGP12.phx.gbl...
    >> Tom's post had a typo: an exclamation mark where there should have been a
    >> period.
    >>
    >> Use
    >> CurrRowNo = Sheet2.MySeq
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >>
    >> "Jim May" <jmay@cox.net> wrote in message
    >> news:sae9f.35513$OM4.33041@dukeread06...
    >>>I think I did as you said, but now I'm getting
    >>> R/T 438 - Obj doesn't support this prop or meth..
    >>>
    >>> After clicking Debug I'm taken to my user module code
    >>> window with highlite covering:
    >>> CurrRowNo = Sheet2!MySeq
    >>>
    >>> Any thoughts on what I might try to fix?
    >>> TIA,
    >>> Jim
    >>>
    >>> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    >>> news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    >>>> assume it is typed/declared at the top of the sheet1 (code name) module
    >>>> outside any procedures
    >>>>
    >>>> Public MySeq
    >>>>
    >>>> then in the userform.
    >>>>
    >>>> v = Sheet1!MySeq
    >>>>
    >>>> --
    >>>> Regards,
    >>>> Tom Ogilvy
    >>>>
    >>>> "Jim May" <jmay@cox.net> wrote in message
    >>>> news:qzc9f.35503$OM4.8753@dukeread06...
    >>>>> Theis is probably simple, but not to me (at this point)...
    >>>>>
    >>>>> If I assign a value (an integer, say 5) to a variable "mySeq" while in
    >>>>> an
    >>>>> Event module, say sheet1 and I need to "use it" immediately in Command
    >>>>> button Click event
    >>>>> of a Form frmPOReqEdit, how would I do that?
    >>>>> TIA
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >




  8. #8
    Chip Pearson
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    > MySeq is created in a Before Double-Click Event

    If by "created" you mean declared, then that variable is
    accessible only within that procedure. You can access from
    outside the procedure. If you need to share a variable between
    two or more procedures, declare the variable outside of and prior
    to any procedure in the module.


    > Cancel = True;
    > Does that matter?


    No.

    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Jim May" <jmay@cox.net> wrote in message
    news:Jve9f.35526$OM4.522@dukeread06...
    > MySeq is created in a Before Double-Click Event
    > which after performing certain code ends with
    > Cancel = True;
    > Does that matter?
    > Jim
    >
    > "Jim May" <jmay@cox.net> wrote in message
    > news:kte9f.35525$OM4.16202@dukeread06...
    >> Yes, thanks, that got me PAST that Line, however I'm
    >> now stopped at the next line with R/T 1004 App...
    >> Holding the cursor over Sheet2.MySeq reads "EMPTY",
    >> probably why it is bombing..
    >> hummmm..
    >> Appreciate your help.
    >> Jim
    >>
    >> "Chip Pearson" <chip@cpearson.com> wrote in message
    >> news:uQkddlb3FHA.3900@TK2MSFTNGP12.phx.gbl...
    >>> Tom's post had a typo: an exclamation mark where there should
    >>> have been a period.
    >>>
    >>> Use
    >>> CurrRowNo = Sheet2.MySeq
    >>>
    >>>
    >>> --
    >>> Cordially,
    >>> Chip Pearson
    >>> Microsoft MVP - Excel
    >>> Pearson Software Consulting, LLC
    >>> www.cpearson.com
    >>>
    >>>
    >>>
    >>> "Jim May" <jmay@cox.net> wrote in message
    >>> news:sae9f.35513$OM4.33041@dukeread06...
    >>>>I think I did as you said, but now I'm getting
    >>>> R/T 438 - Obj doesn't support this prop or meth..
    >>>>
    >>>> After clicking Debug I'm taken to my user module code
    >>>> window with highlite covering:
    >>>> CurrRowNo = Sheet2!MySeq
    >>>>
    >>>> Any thoughts on what I might try to fix?
    >>>> TIA,
    >>>> Jim
    >>>>
    >>>> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    >>>> news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    >>>>> assume it is typed/declared at the top of the sheet1 (code
    >>>>> name) module
    >>>>> outside any procedures
    >>>>>
    >>>>> Public MySeq
    >>>>>
    >>>>> then in the userform.
    >>>>>
    >>>>> v = Sheet1!MySeq
    >>>>>
    >>>>> --
    >>>>> Regards,
    >>>>> Tom Ogilvy
    >>>>>
    >>>>> "Jim May" <jmay@cox.net> wrote in message
    >>>>> news:qzc9f.35503$OM4.8753@dukeread06...
    >>>>>> Theis is probably simple, but not to me (at this point)...
    >>>>>>
    >>>>>> If I assign a value (an integer, say 5) to a variable
    >>>>>> "mySeq" while in an
    >>>>>> Event module, say sheet1 and I need to "use it"
    >>>>>> immediately in Command
    >>>>>> button Click event
    >>>>>> of a Form frmPOReqEdit, how would I do that?
    >>>>>> TIA
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >




  9. #9
    Tom Ogilvy
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    Mental gliche

    Thanks,

    Regards,
    Tom Ogilvy

    "Chip Pearson" <chip@cpearson.com> wrote in message
    news:%23sDenfb3FHA.3400@tk2msftngp13.phx.gbl...
    > > v = Sheet1!MySeq

    >
    > Should be Sheet1.MySeq
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    >
    > "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    > news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    > > assume it is typed/declared at the top of the sheet1 (code
    > > name) module
    > > outside any procedures
    > >
    > > Public MySeq
    > >
    > > then in the userform.
    > >
    > > v = Sheet1!MySeq
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "Jim May" <jmay@cox.net> wrote in message
    > > news:qzc9f.35503$OM4.8753@dukeread06...
    > >> Theis is probably simple, but not to me (at this point)...
    > >>
    > >> If I assign a value (an integer, say 5) to a variable "mySeq"
    > >> while in an
    > >> Event module, say sheet1 and I need to "use it" immediately in
    > >> Command
    > >> button Click event
    > >> of a Form frmPOReqEdit, how would I do that?
    > >> TIA
    > >>
    > >>

    > >
    > >

    >
    >




  10. #10
    Jim May
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    In My Sheet2 code module (at the top)
    after Option Explicit
    I have -- Public MySeq
    Two procedured down I have my On-Double-Click Procedure where MySeq "is
    DECLARED".
    It is this integer that I need in a later procedure of
    the Userform's saving of Control values back to the worksheet.


    "Chip Pearson" <chip@cpearson.com> wrote in message
    news:%239BPmzb3FHA.3868@TK2MSFTNGP12.phx.gbl...
    >> MySeq is created in a Before Double-Click Event

    >
    > If by "created" you mean declared, then that variable is accessible only
    > within that procedure. You can access from outside the procedure. If you
    > need to share a variable between two or more procedures, declare the
    > variable outside of and prior to any procedure in the module.
    >
    >
    >> Cancel = True;
    >> Does that matter?

    >
    > No.
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    > "Jim May" <jmay@cox.net> wrote in message
    > news:Jve9f.35526$OM4.522@dukeread06...
    >> MySeq is created in a Before Double-Click Event
    >> which after performing certain code ends with
    >> Cancel = True;
    >> Does that matter?
    >> Jim
    >>
    >> "Jim May" <jmay@cox.net> wrote in message
    >> news:kte9f.35525$OM4.16202@dukeread06...
    >>> Yes, thanks, that got me PAST that Line, however I'm
    >>> now stopped at the next line with R/T 1004 App...
    >>> Holding the cursor over Sheet2.MySeq reads "EMPTY",
    >>> probably why it is bombing..
    >>> hummmm..
    >>> Appreciate your help.
    >>> Jim
    >>>
    >>> "Chip Pearson" <chip@cpearson.com> wrote in message
    >>> news:uQkddlb3FHA.3900@TK2MSFTNGP12.phx.gbl...
    >>>> Tom's post had a typo: an exclamation mark where there should have been
    >>>> a period.
    >>>>
    >>>> Use
    >>>> CurrRowNo = Sheet2.MySeq
    >>>>
    >>>>
    >>>> --
    >>>> Cordially,
    >>>> Chip Pearson
    >>>> Microsoft MVP - Excel
    >>>> Pearson Software Consulting, LLC
    >>>> www.cpearson.com
    >>>>
    >>>>
    >>>>
    >>>> "Jim May" <jmay@cox.net> wrote in message
    >>>> news:sae9f.35513$OM4.33041@dukeread06...
    >>>>>I think I did as you said, but now I'm getting
    >>>>> R/T 438 - Obj doesn't support this prop or meth..
    >>>>>
    >>>>> After clicking Debug I'm taken to my user module code
    >>>>> window with highlite covering:
    >>>>> CurrRowNo = Sheet2!MySeq
    >>>>>
    >>>>> Any thoughts on what I might try to fix?
    >>>>> TIA,
    >>>>> Jim
    >>>>>
    >>>>> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    >>>>> news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    >>>>>> assume it is typed/declared at the top of the sheet1 (code name)
    >>>>>> module
    >>>>>> outside any procedures
    >>>>>>
    >>>>>> Public MySeq
    >>>>>>
    >>>>>> then in the userform.
    >>>>>>
    >>>>>> v = Sheet1!MySeq
    >>>>>>
    >>>>>> --
    >>>>>> Regards,
    >>>>>> Tom Ogilvy
    >>>>>>
    >>>>>> "Jim May" <jmay@cox.net> wrote in message
    >>>>>> news:qzc9f.35503$OM4.8753@dukeread06...
    >>>>>>> Theis is probably simple, but not to me (at this point)...
    >>>>>>>
    >>>>>>> If I assign a value (an integer, say 5) to a variable "mySeq" while
    >>>>>>> in an
    >>>>>>> Event module, say sheet1 and I need to "use it" immediately in
    >>>>>>> Command
    >>>>>>> button Click event
    >>>>>>> of a Form frmPOReqEdit, how would I do that?
    >>>>>>> TIA
    >>>>>>>
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >




  11. #11
    Tom Ogilvy
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    You shouldn't declare MySeq in you DoubleClick event. It is declared once
    and that is at the top of the module with

    Public MySeq

    when you declare it in DoubleClick it is local to DoubleClick and your
    Public Variable (a different variable) is not visible inside DoubleClick
    because the local doubleclick takes precedence / screens it.

    To summarize, you are providing a value to the local version and the public
    version and a completely separate variable, seen by your Userform module
    code, is uninitialized.
    --
    Regards,
    Tom Ogilvy

    "Jim May" <jmay@cox.net> wrote in message
    news:g8f9f.35528$OM4.30854@dukeread06...
    > In My Sheet2 code module (at the top)
    > after Option Explicit
    > I have -- Public MySeq
    > Two procedured down I have my On-Double-Click Procedure where MySeq "is
    > DECLARED".
    > It is this integer that I need in a later procedure of
    > the Userform's saving of Control values back to the worksheet.
    >
    >
    > "Chip Pearson" <chip@cpearson.com> wrote in message
    > news:%239BPmzb3FHA.3868@TK2MSFTNGP12.phx.gbl...
    > >> MySeq is created in a Before Double-Click Event

    > >
    > > If by "created" you mean declared, then that variable is accessible only
    > > within that procedure. You can access from outside the procedure. If you
    > > need to share a variable between two or more procedures, declare the
    > > variable outside of and prior to any procedure in the module.
    > >
    > >
    > >> Cancel = True;
    > >> Does that matter?

    > >
    > > No.
    > >
    > > --
    > > Cordially,
    > > Chip Pearson
    > > Microsoft MVP - Excel
    > > Pearson Software Consulting, LLC
    > > www.cpearson.com
    > >
    > >
    > >
    > > "Jim May" <jmay@cox.net> wrote in message
    > > news:Jve9f.35526$OM4.522@dukeread06...
    > >> MySeq is created in a Before Double-Click Event
    > >> which after performing certain code ends with
    > >> Cancel = True;
    > >> Does that matter?
    > >> Jim
    > >>
    > >> "Jim May" <jmay@cox.net> wrote in message
    > >> news:kte9f.35525$OM4.16202@dukeread06...
    > >>> Yes, thanks, that got me PAST that Line, however I'm
    > >>> now stopped at the next line with R/T 1004 App...
    > >>> Holding the cursor over Sheet2.MySeq reads "EMPTY",
    > >>> probably why it is bombing..
    > >>> hummmm..
    > >>> Appreciate your help.
    > >>> Jim
    > >>>
    > >>> "Chip Pearson" <chip@cpearson.com> wrote in message
    > >>> news:uQkddlb3FHA.3900@TK2MSFTNGP12.phx.gbl...
    > >>>> Tom's post had a typo: an exclamation mark where there should have

    been
    > >>>> a period.
    > >>>>
    > >>>> Use
    > >>>> CurrRowNo = Sheet2.MySeq
    > >>>>
    > >>>>
    > >>>> --
    > >>>> Cordially,
    > >>>> Chip Pearson
    > >>>> Microsoft MVP - Excel
    > >>>> Pearson Software Consulting, LLC
    > >>>> www.cpearson.com
    > >>>>
    > >>>>
    > >>>>
    > >>>> "Jim May" <jmay@cox.net> wrote in message
    > >>>> news:sae9f.35513$OM4.33041@dukeread06...
    > >>>>>I think I did as you said, but now I'm getting
    > >>>>> R/T 438 - Obj doesn't support this prop or meth..
    > >>>>>
    > >>>>> After clicking Debug I'm taken to my user module code
    > >>>>> window with highlite covering:
    > >>>>> CurrRowNo = Sheet2!MySeq
    > >>>>>
    > >>>>> Any thoughts on what I might try to fix?
    > >>>>> TIA,
    > >>>>> Jim
    > >>>>>
    > >>>>> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    > >>>>> news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    > >>>>>> assume it is typed/declared at the top of the sheet1 (code name)
    > >>>>>> module
    > >>>>>> outside any procedures
    > >>>>>>
    > >>>>>> Public MySeq
    > >>>>>>
    > >>>>>> then in the userform.
    > >>>>>>
    > >>>>>> v = Sheet1!MySeq
    > >>>>>>
    > >>>>>> --
    > >>>>>> Regards,
    > >>>>>> Tom Ogilvy
    > >>>>>>
    > >>>>>> "Jim May" <jmay@cox.net> wrote in message
    > >>>>>> news:qzc9f.35503$OM4.8753@dukeread06...
    > >>>>>>> Theis is probably simple, but not to me (at this point)...
    > >>>>>>>
    > >>>>>>> If I assign a value (an integer, say 5) to a variable "mySeq"

    while
    > >>>>>>> in an
    > >>>>>>> Event module, say sheet1 and I need to "use it" immediately in
    > >>>>>>> Command
    > >>>>>>> button Click event
    > >>>>>>> of a Form frmPOReqEdit, how would I do that?
    > >>>>>>> TIA
    > >>>>>>>
    > >>>>>>>
    > >>>>>>
    > >>>>>>
    > >>>>>
    > >>>>>
    > >>>>
    > >>>>
    > >>>
    > >>>
    > >>
    > >>

    > >
    > >

    >
    >




  12. #12
    Jim May
    Guest

    Re: Public, Private, Event modules, Forms modules,,,

    PROBLEM SOLVED !!
    Thank you Jesus!, and you too Tom and Chip..
    I so much appreciate you guys "giving"
    of your time and resources to "us others"
    who want to (one day) know this great product..
    Good night!!
    Jim

    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:e5t8bbc3FHA.268@TK2MSFTNGP10.phx.gbl...
    > You shouldn't declare MySeq in you DoubleClick event. It is declared once
    > and that is at the top of the module with
    >
    > Public MySeq
    >
    > when you declare it in DoubleClick it is local to DoubleClick and your
    > Public Variable (a different variable) is not visible inside DoubleClick
    > because the local doubleclick takes precedence / screens it.
    >
    > To summarize, you are providing a value to the local version and the
    > public
    > version and a completely separate variable, seen by your Userform module
    > code, is uninitialized.
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Jim May" <jmay@cox.net> wrote in message
    > news:g8f9f.35528$OM4.30854@dukeread06...
    >> In My Sheet2 code module (at the top)
    >> after Option Explicit
    >> I have -- Public MySeq
    >> Two procedured down I have my On-Double-Click Procedure where MySeq "is
    >> DECLARED".
    >> It is this integer that I need in a later procedure of
    >> the Userform's saving of Control values back to the worksheet.
    >>
    >>
    >> "Chip Pearson" <chip@cpearson.com> wrote in message
    >> news:%239BPmzb3FHA.3868@TK2MSFTNGP12.phx.gbl...
    >> >> MySeq is created in a Before Double-Click Event
    >> >
    >> > If by "created" you mean declared, then that variable is accessible
    >> > only
    >> > within that procedure. You can access from outside the procedure. If
    >> > you
    >> > need to share a variable between two or more procedures, declare the
    >> > variable outside of and prior to any procedure in the module.
    >> >
    >> >
    >> >> Cancel = True;
    >> >> Does that matter?
    >> >
    >> > No.
    >> >
    >> > --
    >> > Cordially,
    >> > Chip Pearson
    >> > Microsoft MVP - Excel
    >> > Pearson Software Consulting, LLC
    >> > www.cpearson.com
    >> >
    >> >
    >> >
    >> > "Jim May" <jmay@cox.net> wrote in message
    >> > news:Jve9f.35526$OM4.522@dukeread06...
    >> >> MySeq is created in a Before Double-Click Event
    >> >> which after performing certain code ends with
    >> >> Cancel = True;
    >> >> Does that matter?
    >> >> Jim
    >> >>
    >> >> "Jim May" <jmay@cox.net> wrote in message
    >> >> news:kte9f.35525$OM4.16202@dukeread06...
    >> >>> Yes, thanks, that got me PAST that Line, however I'm
    >> >>> now stopped at the next line with R/T 1004 App...
    >> >>> Holding the cursor over Sheet2.MySeq reads "EMPTY",
    >> >>> probably why it is bombing..
    >> >>> hummmm..
    >> >>> Appreciate your help.
    >> >>> Jim
    >> >>>
    >> >>> "Chip Pearson" <chip@cpearson.com> wrote in message
    >> >>> news:uQkddlb3FHA.3900@TK2MSFTNGP12.phx.gbl...
    >> >>>> Tom's post had a typo: an exclamation mark where there should have

    > been
    >> >>>> a period.
    >> >>>>
    >> >>>> Use
    >> >>>> CurrRowNo = Sheet2.MySeq
    >> >>>>
    >> >>>>
    >> >>>> --
    >> >>>> Cordially,
    >> >>>> Chip Pearson
    >> >>>> Microsoft MVP - Excel
    >> >>>> Pearson Software Consulting, LLC
    >> >>>> www.cpearson.com
    >> >>>>
    >> >>>>
    >> >>>>
    >> >>>> "Jim May" <jmay@cox.net> wrote in message
    >> >>>> news:sae9f.35513$OM4.33041@dukeread06...
    >> >>>>>I think I did as you said, but now I'm getting
    >> >>>>> R/T 438 - Obj doesn't support this prop or meth..
    >> >>>>>
    >> >>>>> After clicking Debug I'm taken to my user module code
    >> >>>>> window with highlite covering:
    >> >>>>> CurrRowNo = Sheet2!MySeq
    >> >>>>>
    >> >>>>> Any thoughts on what I might try to fix?
    >> >>>>> TIA,
    >> >>>>> Jim
    >> >>>>>
    >> >>>>> "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    >> >>>>> news:u1YQG0a3FHA.3276@TK2MSFTNGP10.phx.gbl...
    >> >>>>>> assume it is typed/declared at the top of the sheet1 (code name)
    >> >>>>>> module
    >> >>>>>> outside any procedures
    >> >>>>>>
    >> >>>>>> Public MySeq
    >> >>>>>>
    >> >>>>>> then in the userform.
    >> >>>>>>
    >> >>>>>> v = Sheet1!MySeq
    >> >>>>>>
    >> >>>>>> --
    >> >>>>>> Regards,
    >> >>>>>> Tom Ogilvy
    >> >>>>>>
    >> >>>>>> "Jim May" <jmay@cox.net> wrote in message
    >> >>>>>> news:qzc9f.35503$OM4.8753@dukeread06...
    >> >>>>>>> Theis is probably simple, but not to me (at this point)...
    >> >>>>>>>
    >> >>>>>>> If I assign a value (an integer, say 5) to a variable "mySeq"

    > while
    >> >>>>>>> in an
    >> >>>>>>> Event module, say sheet1 and I need to "use it" immediately in
    >> >>>>>>> Command
    >> >>>>>>> button Click event
    >> >>>>>>> of a Form frmPOReqEdit, how would I do that?
    >> >>>>>>> TIA
    >> >>>>>>>
    >> >>>>>>>
    >> >>>>>>
    >> >>>>>>
    >> >>>>>
    >> >>>>>
    >> >>>>
    >> >>>>
    >> >>>
    >> >>>
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1