LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Using variables in SUBTOTAL functions in Excel/VBA

I am attempting to set up a program in Excel/VBA that
will take raw data that will format it, find the last
row, and Subtotal the column. Everything works except
the SUBTOTAL function.

I have a routine that starts at the top row and works
downward checking for the first empty cell. As it moves
down it tracks the Row by the varialbe "LineNumber" in a
loop with the line "LineNumber=LineNuber+1". When it
reachs the first empty cell I want to use
the "LineNumber" variable as the first arguement. The
Column will be constant in this application. I will then
Copy and Paste to other columns.

The code from recording a Macro is:
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-2235]C:R[-1]C)"

I have attemptd inserting the variable "LineNumber" with:
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,R[-LineNumber]C:R[-
1]C)"

This does not work.

The SUBTOTAL range will always have a top row of 6 as
this is just below the column label. I am also using
AUTOFILTER's in the process to manipulate, then copy and
paste information.

I have attempted to "automate" SUBTOTAL's for a long time
and have yet to find the correct code. Please Help!

Thank you in advance,

Mark
 
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
How to dealing with functions with 30+ variables? Darius Excel Worksheet Functions 7 July 25th 08 12:52 AM
subtotal functions Louise Excel Worksheet Functions 6 February 1st 07 08:51 PM
Can I use variables for workheet name references in Excel functions? Amihai Bareket Excel Discussion (Misc queries) 1 February 4th 05 05:11 PM
Can I use variables for workheet name references in Excel functions? Amihai Bareket Excel Worksheet Functions 1 February 4th 05 05:11 PM
variables in row and cell functions zeraia Excel Programming 1 October 22nd 03 03:55 PM


All times are GMT +1. The time now is 05:16 PM.

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"