PDA

View Full Version : excel macro to subtotal


microgenius
08-12-03, 17:41
I have a macro to subtotal a set of data. This data will always be different amount of lines. I can set the macro to subtotal only current range. If I try to include all lines so that I account for when the lines of data increase, it will not allow the first line to be included. Any ideas?

qha_vn
08-13-03, 08:56
how do you get the current range?

microgenius
08-13-03, 09:48
i just got it from selecting the range. If i use the current range, everything is fine, but it is when i expand the range beyond the current data to accomadate for future expansion is where i have the problem.

qha_vn
08-14-03, 08:24
i meant do you use something like this in ur macro

Range("A1").Select
Selection.CurrentRegion.Select

provided that your first cell in data range is A1, these codes always select all rows for you when you run the macro even if you have 2 rows or 2000 rows in your data range as long as there is no blank row(s) separate(s) the data range.

hope this helps