Hi Alf,
Clicking a cell in the body of the data table?
Does this mean click anywhere in the spreadsheet?
Say for instance cell D7?
Because if it do we have a problem.
If I do that I get a warning message:
Microsoft Excel cannot determine which row in your list or selection
contains column labels, which are required for this command.
However I think I managed to get around that by selecting a cell in column A
(the column I want counted) and then OK, but I had to select a column within
the sheet to mess up with the output - it wouldn't let me use an empty one -
which would have made more sense to me.
So, maybe data table means the column I want to work with?
Okay, I followed all the steps and ended up with my data split into neat
little packages of names, then Count and the total in the designated column.
I pasted the sub, and changed the H to A.
Swapped to the excel sheet and created the command button.
Clicked on said button and ..............................
Nothing.
Nothing at all seems to happen, the command button gets a nice dotted line
around it, the sheet flickers - but essentially it all remains exactly as it
was before the button was pressed.
Should I have changed the r to the column where I placed the subtotals?
I won't try this without advice, just in case because I feel I may have
missed some earlier step somewhere - or done something wrong.
Over to you
AlfD > said:
Hi Dave!
I suggest you get a copy of your penultimate post in front of you (the
longish one running from 1 to 6). We need to sing from the same
hymn-sheet.
1. Fine
2. Fine.
3. No. I admit wasn't explicit about this. Don't select a column. Just
click on a cell in the body of the data table. Now you will be able to
track through the points in my last notes on Subtotals.
[Learning point: You knew you had made a decision (hence your question
"-right?"). It didn't deliver the scenario I predicted. If you trust
me: you have to be prepared to question your own assumptions and go
back and try another one.]
So: you need to go back to point 3 and just click on a cell in the data
table. Take it from there and follow the original script.
Now: There's another small deviation.
4. No: don't copy my sub into a blank document and take out its
comments. Why? Because you don't need to and it's just another
potential source of error. So why take chances? See below.
The issue of whether to take A or B should resolve itself if you stick
to the straight and narrow on 3 above. The main thing is that it is the
column with Names which is going to be the determinant of when a
subtotal will be inserted.
5. Now to the sub.
First thing is: don't do this bit before the first part is up and
secure. Sort out the Subtotals step until you have a table with ALL of
your data columns available and sub-divided by name into neat bundles
with a number in an appropriate column. (I described that last time.)
So: it looks as though you got to the code page and pasted the sub.
Good. (But if there are still problems later, this is the point I would
want to look at first.)
Now you need to get back to the worksheet with your database on it.
One way is to click the Microsoft Excel button on the task bar at the
bottom of the screen. There are various ways: they aren't all that
intuitive. Your click on the big X probably did the job fine.
6. This is the simple bit! Go to View|Toolbars and select Control
Toolbox. This will produce a toolbar which you might like to drag to
the side of the screen and park there for convenience.
Now hover your cursor over the 6th item down which looks like a button
and carries the tooltips message Command Button. Left-Click on this.
Now move your cursor to a convenient spot on your database sheet. You
should have a cross-hair cursor now. Draw a box with your mouse (left
button down). Any size: any location will do.
This is to be the command button I referred to.
I'm going to assume (FLW) that you have no other buttons on this sheet.
Tell me if you have.
Go back to the Control Toolbox toolbar. Click the first box (tooltip
should say Exit Design Mode).
Now (for the nth time) save your work.
Ready now to go. Click on this button we have just created.
Tell us how you get on.
Alf