PDA

View Full Version : Cell Incrementation



Chuck31
11-20-2007, 09:44 PM
Hi,

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

Thanks

Bob Phillips
11-21-2007, 12:17 AM
Private Sub CommandButton1_Click()
If Not Intersect(ActiveCell, Range("A11:A47")) Is Nothing Then
ActiveCell.Value = ActiveCell.Value + 1
End If
End Sub

Chuck31
11-22-2007, 07:51 AM
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.

lucas
11-22-2007, 10:05 AM
How about a formula? Put this in I11 and drag down. then add data to column C

=IF(C11<>"",COUNTA($C$1:C11)&".","")

Chuck31
11-22-2007, 11:37 AM
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.

mdmackillop
11-22-2007, 12:15 PM
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?

lucas
11-22-2007, 12:17 PM
Not positive I understand your need but try this..see attached

Chuck31
11-22-2007, 12:32 PM
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

mdmackillop
11-22-2007, 12:54 PM
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?

Chuck31
11-22-2007, 12:59 PM
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

Chuck31
11-22-2007, 02:17 PM
Has anyone figure it out ?
I've been scratching my brain, and cannot find a way to make it work.:banghead:

mdmackillop
11-22-2007, 02:20 PM
I can't relate this information to your userform or anything else.

Chuck31
11-22-2007, 02:25 PM
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

mdmackillop
11-22-2007, 02:59 PM
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.

Chuck31
11-22-2007, 03:14 PM
There you go ;)

mdmackillop
11-23-2007, 01:52 AM
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.