Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Finding cells and summing variable cells

OK, I have a twofold problem.

First, I scan down the A column for the value "Grand
Total". I need to somehow store the row value for recall
in later code, but am not sure how to do this, or how to
recall it. For instance, I'd like to make my code run
within certain cells in columns E, G, and I and the row
that "Grand Total" is on.

Secondly, I need to total every "=Sum" field above the
specified cell, but can't even begin to fathom how to
accomplish this.

Help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Finding cells and summing variable cells

Chris -

You need to set a variable value equal to the row property of the cell
containing the value "Grand Total". I don't know what method you're using
to locate that cell, but once you have it, you can say something like this:

totalRow = [cell containing "Grand Total"].row

& then use the totalRow variable whenever you need that row number.

I'm afraid that I'm not sure exactly what your second question is asking.
Do you just want the number representing the sum or do you want the sum
formula entered into your spreadsheet? Or something else?

Good luck!
"Chris M." wrote in message
...
OK, I have a twofold problem.

First, I scan down the A column for the value "Grand
Total". I need to somehow store the row value for recall
in later code, but am not sure how to do this, or how to
recall it. For instance, I'd like to make my code run
within certain cells in columns E, G, and I and the row
that "Grand Total" is on.

Secondly, I need to total every "=Sum" field above the
specified cell, but can't even begin to fathom how to
accomplish this.

Help is greatly appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Finding cells and summing variable cells

I appreciate the reply. What I am actually looking for is
a way to Sum them, wether it entails having the formula or
not really doesn't matter. This spreadsheet is actually
created on the fly and never modified. I'm just writing
the code to format it all properly.

The Grand Totals need to be comprised of every "=Sum" line
above it, which are also in bold. If only there were an
IfBold statement.

Thanks again for the help

-----Original Message-----
Chris -

You need to set a variable value equal to the row

property of the cell
containing the value "Grand Total". I don't know what

method you're using
to locate that cell, but once you have it, you can say

something like this:

totalRow = [cell containing "Grand Total"].row

& then use the totalRow variable whenever you need that

row number.

I'm afraid that I'm not sure exactly what your second

question is asking.
Do you just want the number representing the sum or do

you want the sum
formula entered into your spreadsheet? Or something else?

Good luck!
"Chris M." wrote in message
...
OK, I have a twofold problem.

First, I scan down the A column for the value "Grand
Total". I need to somehow store the row value for

recall
in later code, but am not sure how to do this, or how to
recall it. For instance, I'd like to make my code run
within certain cells in columns E, G, and I and the row
that "Grand Total" is on.

Secondly, I need to total every "=Sum" field above the
specified cell, but can't even begin to fathom how to
accomplish this.

Help is greatly appreciated.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Finding cells and summing variable cells

Chris,

This will find the row number

Dim rw As Long

rw = Cells.Find(What:="grand total", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False) _
.Row

compile and debug it first to make sure there aren't any extraneous spaces
and such...
--
sb
"Virginia Morris" wrote in message
...
Chris -

You need to set a variable value equal to the row property of the cell
containing the value "Grand Total". I don't know what method you're using
to locate that cell, but once you have it, you can say something like

this:

totalRow = [cell containing "Grand Total"].row

& then use the totalRow variable whenever you need that row number.

I'm afraid that I'm not sure exactly what your second question is asking.
Do you just want the number representing the sum or do you want the sum
formula entered into your spreadsheet? Or something else?

Good luck!
"Chris M." wrote in message
...
OK, I have a twofold problem.

First, I scan down the A column for the value "Grand
Total". I need to somehow store the row value for recall
in later code, but am not sure how to do this, or how to
recall it. For instance, I'd like to make my code run
within certain cells in columns E, G, and I and the row
that "Grand Total" is on.

Secondly, I need to total every "=Sum" field above the
specified cell, but can't even begin to fathom how to
accomplish this.

Help is greatly appreciated.





Reply
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
Summing 2 columns cells into a 3rd colums cells Wayne Cadigan Excel Discussion (Misc queries) 1 May 13th 10 08:34 PM
Summing a Variable Number of Cells hammerdin Excel Discussion (Misc queries) 1 August 27th 07 11:43 PM
Summing Cells with #N/A Joan NYC Excel Worksheet Functions 8 February 26th 07 07:57 AM
Finding days between cells C and L where the cells may be empty Jack Excel Worksheet Functions 1 January 9th 06 06:47 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM


All times are GMT +1. The time now is 02:59 PM.

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

About Us

"It's about Microsoft Excel"