+ Reply to Thread
Results 1 to 5 of 5

Default in a textbox and change a module name

  1. #1
    filo666
    Guest

    Default in a textbox and change a module name

    2 questions:
    1)
    I have a form that ask the user for the bill number (a 10 numbers
    number),and the user needs to type all the numbers each time that a bill is
    done, so I want to use a default value in the textbox1 linked to the last
    value (that is saved in a cell c5) + 1, (in cell c1 appears 0889888881 so in
    the textbox appears 0889888882)
    Pd. I know that this can be done automatically, but because there is some
    time that bills are cancelled I need to ask the user for the bill number.
    Pd2. I know that default value is an option on inputbox property, but I
    cant use inputbox because my form has a lot of buttons¡¡¡¡¡¡

    2)
    There is some way to change the module names (instead of module1 say
    easyprgms1) and also to lookup for a specific sub (because I have 100 subs
    and each time I need to modify something I need to check in each of the 15
    modules that I have)

    Tanks for your Help


  2. #2
    Tom Ogilvy
    Guest

    Re: Default in a textbox and change a module name

    Do you have a list of Bill Numbers

    to reduce errors, why not use a combobox and let the user select the Bill
    number.

    otherwise

    Private Sub Userform_Activate()
    Textbox1.Text = format(Worksheets("Sheet1") _
    .Range("C5") + 1,"0000000000")
    End Sub


    In the project explorer, select the module and look in the properties window
    (F4 if it isn't visible) Replace ModuleX with the name you want. (Name is
    the only property)

    --
    Regards,
    Tom Ogilvy

    "filo666" <[email protected]> wrote in message
    news:[email protected]...
    > 2 questions:
    > 1)
    > I have a form that ask the user for the bill number (a 10 numbers
    > number),and the user needs to type all the numbers each time that a bill

    is
    > done, so I want to use a default value in the textbox1 linked to the last
    > value (that is saved in a cell c5) + 1, (in cell c1 appears 0889888881 so

    in
    > the textbox appears 0889888882)
    > Pd. I know that this can be done automatically, but because there is some
    > time that bills are cancelled I need to ask the user for the bill number.
    > Pd2. I know that default value is an option on inputbox property, but I
    > cant use inputbox because my form has a lot of buttons¡¡¡¡¡¡
    >
    > 2)
    > There is some way to change the module names (instead of module1 say
    > easyprgms1) and also to lookup for a specific sub (because I have 100 subs
    > and each time I need to modify something I need to check in each of the 15
    > modules that I have)
    >
    > Tanks for your Help
    >




  3. #3
    filo666
    Guest

    Re: Default in a textbox and change a module name

    thaknd tom, I have another question, what is an event?, I found this term in
    tge class chapter of my "VB for Dummies book"¡¡¡¡¡

    TIA
    "Tom Ogilvy" wrote:

    > Do you have a list of Bill Numbers
    >
    > to reduce errors, why not use a combobox and let the user select the Bill
    > number.
    >
    > otherwise
    >
    > Private Sub Userform_Activate()
    > Textbox1.Text = format(Worksheets("Sheet1") _
    > .Range("C5") + 1,"0000000000")
    > End Sub
    >
    >
    > In the project explorer, select the module and look in the properties window
    > (F4 if it isn't visible) Replace ModuleX with the name you want. (Name is
    > the only property)
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "filo666" <[email protected]> wrote in message
    > news:[email protected]...
    > > 2 questions:
    > > 1)
    > > I have a form that ask the user for the bill number (a 10 numbers
    > > number),and the user needs to type all the numbers each time that a bill

    > is
    > > done, so I want to use a default value in the textbox1 linked to the last
    > > value (that is saved in a cell c5) + 1, (in cell c1 appears 0889888881 so

    > in
    > > the textbox appears 0889888882)
    > > Pd. I know that this can be done automatically, but because there is some
    > > time that bills are cancelled I need to ask the user for the bill number.
    > > Pd2. I know that default value is an option on inputbox property, but I
    > > cant use inputbox because my form has a lot of buttons¡¡¡¡¡¡
    > >
    > > 2)
    > > There is some way to change the module names (instead of module1 say
    > > easyprgms1) and also to lookup for a specific sub (because I have 100 subs
    > > and each time I need to modify something I need to check in each of the 15
    > > modules that I have)
    > >
    > > Tanks for your Help
    > >

    >
    >
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Default in a textbox and change a module name

    In writing the code for Excel, the authors have defined certain "Events".
    This is code that will call code you design and tie to this event. For
    example, manually editing a cell in Excel triggers a call to the
    worksheet_Change event. If I put code in that event declaration or put a
    call to one of my macros in the event declaration, whenever a cell is
    edited, the event will be executed and my code will in turn be executed.

    See Chip Pearson's page on Events
    http://www.cpearson.com/excel/events.htm

    The Activate event for a userform is fired whenever the userform is
    activated.

    If you go into the Userform code module, in the left dropdown select
    Userform and in the right dropdown (at the top of the module), select
    Activate.

    --
    Regards,
    Tom Ogilvy


    "filo666" <[email protected]> wrote in message
    news:[email protected]...
    > thaknd tom, I have another question, what is an event?, I found this term

    in
    > tge class chapter of my "VB for Dummies book"¡¡¡¡¡
    >
    > TIA
    > "Tom Ogilvy" wrote:
    >
    > > Do you have a list of Bill Numbers
    > >
    > > to reduce errors, why not use a combobox and let the user select the

    Bill
    > > number.
    > >
    > > otherwise
    > >
    > > Private Sub Userform_Activate()
    > > Textbox1.Text = format(Worksheets("Sheet1") _
    > > .Range("C5") + 1,"0000000000")
    > > End Sub
    > >
    > >
    > > In the project explorer, select the module and look in the properties

    window
    > > (F4 if it isn't visible) Replace ModuleX with the name you want. (Name

    is
    > > the only property)
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "filo666" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 2 questions:
    > > > 1)
    > > > I have a form that ask the user for the bill number (a 10 numbers
    > > > number),and the user needs to type all the numbers each time that a

    bill
    > > is
    > > > done, so I want to use a default value in the textbox1 linked to the

    last
    > > > value (that is saved in a cell c5) + 1, (in cell c1 appears 0889888881

    so
    > > in
    > > > the textbox appears 0889888882)
    > > > Pd. I know that this can be done automatically, but because there is

    some
    > > > time that bills are cancelled I need to ask the user for the bill

    number.
    > > > Pd2. I know that default value is an option on inputbox property, but

    I
    > > > cant use inputbox because my form has a lot of buttons¡¡¡¡¡¡
    > > >
    > > > 2)
    > > > There is some way to change the module names (instead of module1 say
    > > > easyprgms1) and also to lookup for a specific sub (because I have 100

    subs
    > > > and each time I need to modify something I need to check in each of

    the 15
    > > > modules that I have)
    > > >
    > > > Tanks for your Help
    > > >

    > >
    > >
    > >




  5. #5
    Bob Phillips
    Guest

    Re: Default in a textbox and change a module name

    An event is something that happens. Modern languages allow you to monitor
    and act upon events.

    For instance, opening a workbook is an event. VBA allows code to be written
    that is triggered by that event, and allows the developer to take action
    based upon that workbook opening.

    Other such events are a worksheet being activated, a cell being selected, a
    cell being changed.

    In your book, being VB, it probably won't cover Excel events, but should
    cover form control events. Forms will have controls, such as checkboxes,
    textboxes, command buttons. They would be useless until you were able to
    code based upon something happening to them, so many events for the controls
    are exposed, such as the click event, change event, etc.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "filo666" <[email protected]> wrote in message
    news:[email protected]...
    > thaknd tom, I have another question, what is an event?, I found this term

    in
    > tge class chapter of my "VB for Dummies book"¡¡¡¡¡
    >
    > TIA
    > "Tom Ogilvy" wrote:
    >
    > > Do you have a list of Bill Numbers
    > >
    > > to reduce errors, why not use a combobox and let the user select the

    Bill
    > > number.
    > >
    > > otherwise
    > >
    > > Private Sub Userform_Activate()
    > > Textbox1.Text = format(Worksheets("Sheet1") _
    > > .Range("C5") + 1,"0000000000")
    > > End Sub
    > >
    > >
    > > In the project explorer, select the module and look in the properties

    window
    > > (F4 if it isn't visible) Replace ModuleX with the name you want. (Name

    is
    > > the only property)
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > > "filo666" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 2 questions:
    > > > 1)
    > > > I have a form that ask the user for the bill number (a 10 numbers
    > > > number),and the user needs to type all the numbers each time that a

    bill
    > > is
    > > > done, so I want to use a default value in the textbox1 linked to the

    last
    > > > value (that is saved in a cell c5) + 1, (in cell c1 appears 0889888881

    so
    > > in
    > > > the textbox appears 0889888882)
    > > > Pd. I know that this can be done automatically, but because there is

    some
    > > > time that bills are cancelled I need to ask the user for the bill

    number.
    > > > Pd2. I know that default value is an option on inputbox property, but

    I
    > > > cant use inputbox because my form has a lot of buttons¡¡¡¡¡¡
    > > >
    > > > 2)
    > > > There is some way to change the module names (instead of module1 say
    > > > easyprgms1) and also to lookup for a specific sub (because I have 100

    subs
    > > > and each time I need to modify something I need to check in each of

    the 15
    > > > modules that I have)
    > > >
    > > > Tanks for your Help
    > > >

    > >
    > >
    > >




+ 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