Consulting

Results 1 to 16 of 16

Thread: Cell Incrementation

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location

    Cell Incrementation

    Hi,

    I'm trying to incremente a cell with commandbutton_click
    range is A11 to A47

    Thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub CommandButton1_Click()
    If Not Intersect(ActiveCell, Range("A11:A47")) Is Nothing Then
    ActiveCell.Value = ActiveCell.Value + 1
    End If
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Thanks !
    But what I'm trying to achieve is by clicking the commandbutton it will generate a number starting from 1 and incremented by on the next row every time it's clicked. (cell range C11:C47)

    Ex: I can have a task that will generate only one activity, then in my colomn I should have 1. If a task has multiple subtasks, then I'll have 1, 2,4,5,etc on each row of the subtask.

    Also I has wondering if there's a way to sum all those subtask related to the the general task.


    Thanks so much for all your help.

  4. #4
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    How about a formula? Put this in I11 and drag down. then add data to column C

    =IF(C11<>"",COUNTA($C$1:C11)&".","")
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Maybe it's easier to understand what i'm trying to explain and do based on my file.

    The main objective and purpose of my file, is to time activities and collect data through a userform, by choosing different criterias, activities and then dump them into the corresonding cell on the sheet.

    I can have one activity or I can have one activity with multiple sub-activities. What i'm trying to figure out, is how to generate an activity number that is sequential when an activity is created, and another number when a sub-activity is also created. On top of I need to be able to sum up the total of each activity that has sub-activities or group them up.


    Please note that data in file is in french.

    Thanks for your help and hope this makes it clearer to understand.

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Chuck,
    Can you add some data to your example and repost it? I'm not clear where subgroups should go.
    Is one of your form buttons to be used to add the data?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #7
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Not positive I understand your need but try this..see attached
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  8. #8
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Nothing seemed to be changed from my previous file !

    How my the file is supposed to function.

    1) click on start chrono
    2) a userform is opened
    3) click on Go button, timer will start
    4) select an activity from the listbox1 "tache/action"
    5) select a from listbox2 "module/departement"
    6) you can write a note in the textbox "Description/notes"
    7) click stop, timer will stop
    8) click copier button to copy the data selected of entered into the proper cells on the sheet. The data is then cleared from the form.
    9) click on "Nouvelle Action" button to generate a activity number, if it's the first then it's 1, if it's the second then 2. if it's a subactivity of the second one then it's 2 also or maybe 2.1.
    That's the function i'm trying to program but doesn't work.

    Thanks once again for all your help

  9. #9
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    if it's the first then it's 1, if it's the second then 2. if it's a subactivity of the second one then it's 2 also or maybe 2.1.
    You'll need to explain first and second. Compared to what? What is a sub-activity?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  10. #10
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    I need to time each activity or transaction.
    Therefore, let's say an activity can be to order pizza. But in order to have my pizza i need to do subactivities, such as, choose what type, what size, pay, get change back. All those are sub activities of the General activity that is ordering a pizza.
    Other activities don't have sub activities, only one action is made or done.

    Hope that help in order to understand better my request.

    Thanks, I appreciate all your help

  11. #11
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Has anyone figure it out ?
    I've been scratching my brain, and cannot find a way to make it work.

  12. #12
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    I can't relate this information to your userform or anything else.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  13. #13
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    In my userform, the general activities are the ones in the listbox1.

    Therefore, a general activity is selected from that listbox. If the person doing that general activity does multiple and different task or sub-activities to achieve that general one, then for each subactivity a time will be recorded.

    Is that clearer, I know it's not that easy something to explain.
    Anything you suggest I do in order to make your life easier and help me out with that issue ?

    Thanks so much

  14. #14
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Still struggling with a logic I can put into code. Can you add a few more data and fill in 1,1.2, 2, 2.1,2.2 etc. as you would expect to see it, with some explanatory notes.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  15. #15
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    There you go

  16. #16
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Sorry, I can see no logic here that would allow me to code this. I think you need to reconsider your design to differentiate sub-activities from new activities.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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