LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Programming a worksheet to find last row and add formula's

Obviously you can loop through all the data and delete rows that do not
refer to one of the 4 managers.

You don't give any data layout, so I can't say what is the best way to do
it.

If you have a manager name on each row, then you can filter the data you
want. Or even if you leave the data as is, you can use the countif and
sumif worksheet functions. (but can also be used in VBA).

Another approach would be to apply a pivot table to your data. This is
easiest approach to summarizing data and doesn't really require programming
unless you want to automate the application of the pivot tables. (found
under the data menu).

Debra Dalgleish has a lot of information about pivot tables at her site:
http://www.contextures.com/tiptech.html

Without knowing how you data is laid out, it is hard to say. I probably
won't be around for a while, so you may want to post with more details as a
new topic.

--
Regards,
Tom Ogilvy



"rjr" wrote in message
...
Thanks so much, got it and it works.
Wife sprung two more things on me

All rows are equal width so the new part of the programming worked as you
said;

1. I may have as many as 15 to 20 different groups with many entries each
(lets say name of supervisor with many subordinates under)
How can I get a sub total for each supervisor of how many subordinates
there are under that person AND since I am only looking for 4 individual
supervisors how can I eliminate all the other supervisors with their
subordinates.?

What she tells me she needs is a count of the same 4 supervisors all the
time with a breakdown of a count of subordinates and the aging days for
each as per the previous formula. This same programming will be used for
20 odd worksheets as they are imported.

This should be the last, now that she has clarified it.
Hope you can help, Thanks
Bob Reynolds


"Tom Ogilvy" wrote in message
...
cells(1,"IV").End(xltoLeft).Column

use a row that will give you the acurate count.

--
Regards,
Tom Ogilvy

"rjr" wrote in message
. ..
Tom,

forget my other post about the maxa, since I hadn't completed looking
through your response.

The MaxA works fine and is doing exactly what I wanted it to. I tried
the Ctrl-Shift-8 and it did what you said it would do and confirmed I
had what I wanted selected....

Is there something I could put in there to automatically calculate the
number of columns... rng.offset(0,-1).Resize(,20) make the 20 where it
would calculate it????


"Tom Ogilvy" wrote in message
...
rng refers to column B, so you would offset it one column as shown
below.

Cells(lastrow + 2,"c").Formula = "=Maxa(" & rng.Offset(0,1).Address &
")"

If you want the sum, then Use Sum instead of Maxa.

Current region should select all the columns that are contiguous.
Click in your data and do Ctrl+Shift+8

this is the equivalent of the current region command. If that picks
up all the data you want, then you shouldn't need to change. If it
doesn't, then you might need to alter the code

Assuming rng refers to the proper number of rows in column B, then

rng.offset(0,-1).Resize(,20)

would pick up columns A (the offset -1) for 20 columns as an example.


--
Regards,
Tom Ogilvy



"rjr" wrote in message
...
Tom Thank you, as usual I have another one or two questions.
1. If I have varing columns? some times I'll have 8, 10, 15 etc so
they will vary for me. Do I need to set them?

2. Set rng = Range(" B" & Firstrow & ":B" & LastRow)
Cells(lastrow + 2,"c").Formula = "=Maxa(" & rng.Address & ")" I
modified this to give me totals for column "C" with the formula maxa
().. Obviously it didn't work as it returned a zero, what do i need
to change in your formula. I thought it would auto update the column
automatically??
Thanks for your patience
Bob






"Tom Ogilvy" wrote in message
...

Dim lastrow as Long, firstrow as Long
Dim rng as Range
lastrow = cells(rows.count,"B").End(xlup).row
firstrow = cells(lastrow,"B").End(xlup).row

Set rng = Range(" B" & Firstrow & ":B" & LastRow)
Cells(lastrow + 2,"B").Formula = "=Max(" & rng.Address & ")"

rng.CurrentRegion.Select
application.Dialogs(xlDialogSort).Show

Excel can sort on up to 3 columns at one time - so this just shows
the sort dialog.

--
Regards,
Tom Ogilvy




"rjr" wrote in message
news:QoPjh.5351$_X.2614@bigfe9...
Hello to all and Merry Christmas,



I am responsible for downloading about 20 data sheets daily from the
mainframe and they are saved in excel worksheet format on my desktop
computer.

Each download has a different amount of rows in it. Example: 1 may
have 15 rows and 2 may have 200 rows, and 3 may have 25 rows,
etc...........



1. My first problem is: How do I make excel recognize the very last
row ?

2. If row 200 is the last entry, then I would want the total's added
to row 202, leaving one space between the report and the totals.

3. The totals row would place my formula for each column in this
row. i.e.: one formula would be to count the highest day out..
Column B would return 7 in the example.

I also may have other formulas that might need to be entered so
if someone wouldn't mind, show me an example of putting a different
formula in the added formula for col B.

4. Then I need to sort the columns by one, two or even three
columns. Is there a way to program a dialog box to pop up, after
entering the formula's and have it ask which columns should be
sorted first, second and third; or would it be simpler to simply ask
what col for first sort, then have another popup ask for 2nd sort
and then a 3rd.......... I have little to no experience here and can
only follow directions...



Here's a small example:

A = Source ID - I would like to sort all the data by this column as
soon as all the data is selected.

B = Aging report - Formula will show the highest date for this
column

C = names - no need to group

D = Date - no need to sort

E = A special Code and may do the sort by it instead of A -







Example: let's say I have 32 rows of data when I export this
document. When I run the macro I would like it to determine how many
rows I have, add the formula for whatever I need in row 33 and ask
me to sort by (give me the option of putting in which column) and
then ask if there is secondary sort. Once that's completed, it
should sort again.



A B C D E

ASTFED 7 Name Date 38fjmv7

978DJDE 6 Name Date dkie8fj8

Etc.....





And finally I have a need, with this same worksheet, to subtotal
numbers by either col A or col E or another column to be determined
later. Any ideas??



Any help would be greatly appreciated. Thanks so much

Bob Reynolds
















 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Formula's / Programming Tannis1005 Excel Discussion (Misc queries) 4 July 3rd 08 03:00 AM
Can I show a formula's result on a worksheet tab? ukplay Excel Worksheet Functions 1 September 6th 05 04:16 PM
Accessign formula's in worksheet that appear to have been hidden Tim Ashcom Excel Discussion (Misc queries) 9 July 22nd 05 04:53 PM
where can i find a list of excell formula's? macart New Users to Excel 2 February 15th 05 09:51 PM
where can i find a list of excell formula's? Art New Users to Excel 3 February 12th 05 10:34 PM


All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"