Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Creating a report by For Each...

I gather information from various, named ranges, in a number of worksheets in
a specific workbook. I use a "For Each loop" to search in every sheet for
values in defined ranges and then place that value in a summary report. This
works fine with one single value in that range. However, one of these ranges,
a list, contains numbers that I want to sum up and place in the report.

This is part of the code
....
Next rn
If rnExists = True Then
With totalSheet
On Error Resume Next
.Cells(1, i).Value = sName
.Cells(2, i).Value = Range(sName & "!Database").Rows.Count
.Cells(3, i).Value = "=Sum(Range(sName & !sumPremiums))"
End With
i = i + 1
Else
....

It is the third .Cells-argument that causes my problem. Would be happy for
any solution.
--
Stef
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Creating a report by For Each...

Hi Stef,


.Cells(3, i).Value = "=Sum(Range(sName & !

sumPremiums))"

It is the third .Cells-argument that causes my problem.




Try .cells(3,i).Formula instead of .Value...

Best

Markus
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Creating a report by For Each...

Assuming you want a formula like =Sum(Sheet1!sumPremiums)

where sumPremiums is a sheet level name:

.Cells(3, i).Value = "=Sum('" & sName & "'!sumPremiums)"

--
Regards,
Tom Ogilvy

"Stef" wrote in message
...
I gather information from various, named ranges, in a number of worksheets

in
a specific workbook. I use a "For Each loop" to search in every sheet for
values in defined ranges and then place that value in a summary report.

This
works fine with one single value in that range. However, one of these

ranges,
a list, contains numbers that I want to sum up and place in the report.

This is part of the code
...
Next rn
If rnExists = True Then
With totalSheet
On Error Resume Next
.Cells(1, i).Value = sName
.Cells(2, i).Value = Range(sName & "!Database").Rows.Count
.Cells(3, i).Value = "=Sum(Range(sName & !sumPremiums))"
End With
i = i + 1
Else
...

It is the third .Cells-argument that causes my problem. Would be happy

for
any solution.
--
Stef



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Creating a report by For Each...

Hi Markus!

I tried that without success. Thanks anyway.

Stef

"Markus Scheible" wrote:

Hi Stef,


.Cells(3, i).Value = "=Sum(Range(sName & !

sumPremiums))"

It is the third .Cells-argument that causes my problem.




Try .cells(3,i).Formula instead of .Value...

Best

Markus

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Creating a report by For Each...

Hi Stef,

I tried that without success. Thanks anyway.


okay... so what exactly have you defined as sumPremiums?
Is it a range of cells you want to sum?

Best

Markus



.Cells(3, i).Value = "=Sum(Range(sName & !

sumPremiums))"

It is the third .Cells-argument that causes my

problem.



Try .cells(3,i).Formula instead of .Value...

Best

Markus

.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Creating a report by For Each...

Actually, I want the sum of numbers in a column that I named "sumPremiums" to
be placed in my report the same way I do with the other .Cells arguments. So
the formula itself is not important, only the result from that calculation.

Regards Stef

"Tom Ogilvy" wrote:

Assuming you want a formula like =Sum(Sheet1!sumPremiums)

where sumPremiums is a sheet level name:

.Cells(3, i).Value = "=Sum('" & sName & "'!sumPremiums)"

--
Regards,
Tom Ogilvy

"Stef" wrote in message
...
I gather information from various, named ranges, in a number of worksheets

in
a specific workbook. I use a "For Each loop" to search in every sheet for
values in defined ranges and then place that value in a summary report.

This
works fine with one single value in that range. However, one of these

ranges,
a list, contains numbers that I want to sum up and place in the report.

This is part of the code
...
Next rn
If rnExists = True Then
With totalSheet
On Error Resume Next
.Cells(1, i).Value = sName
.Cells(2, i).Value = Range(sName & "!Database").Rows.Count
.Cells(3, i).Value = "=Sum(Range(sName & !sumPremiums))"
End With
i = i + 1
Else
...

It is the third .Cells-argument that causes my problem. Would be happy

for
any solution.
--
Stef




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Creating a report by For Each...

Hi Stef,


Actually, I want the sum of numbers in a column that I

named "sumPremiums" to
be placed in my report the same way I do with the

other .Cells arguments. So
the formula itself is not important, only the result from

that calculation.

so then, why not use

Cells(3,i).Value = Sum(Sheets(sName).Range(sumpremiums) ?

Best

Markus



Regards Stef

"Tom Ogilvy" wrote:

Assuming you want a formula like =Sum(Sheet1!

sumPremiums)

where sumPremiums is a sheet level name:

.Cells(3, i).Value = "=Sum('" & sName & "'!

sumPremiums)"

--
Regards,
Tom Ogilvy

"Stef" wrote in message
news:4133E996-64AE-4A01-9D95-

...
I gather information from various, named ranges, in a

number of worksheets
in
a specific workbook. I use a "For Each loop" to

search in every sheet for
values in defined ranges and then place that value in

a summary report.
This
works fine with one single value in that range.

However, one of these
ranges,
a list, contains numbers that I want to sum up and

place in the report.

This is part of the code
...
Next rn
If rnExists = True Then
With totalSheet
On Error Resume Next
.Cells(1, i).Value = sName
.Cells(2, i).Value = Range(sName & "!

Database").Rows.Count
.Cells(3, i).Value = "=Sum(Range(sName & !

sumPremiums))"
End With
i = i + 1
Else
...

It is the third .Cells-argument that causes my

problem. Would be happy
for
any solution.
--
Stef




.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Creating a report by For Each...

.Cells(3, i).Value =Application.Sum(Range(sName & "!sumPremiums"))

--
Regards,
Tom Ogilvy

"Stef" wrote in message
...
Actually, I want the sum of numbers in a column that I named "sumPremiums"

to
be placed in my report the same way I do with the other .Cells arguments.

So
the formula itself is not important, only the result from that

calculation.

Regards Stef

"Tom Ogilvy" wrote:

Assuming you want a formula like =Sum(Sheet1!sumPremiums)

where sumPremiums is a sheet level name:

.Cells(3, i).Value = "=Sum('" & sName & "'!sumPremiums)"

--
Regards,
Tom Ogilvy

"Stef" wrote in message
...
I gather information from various, named ranges, in a number of

worksheets
in
a specific workbook. I use a "For Each loop" to search in every sheet

for
values in defined ranges and then place that value in a summary

report.
This
works fine with one single value in that range. However, one of these

ranges,
a list, contains numbers that I want to sum up and place in the

report.

This is part of the code
...
Next rn
If rnExists = True Then
With totalSheet
On Error Resume Next
.Cells(1, i).Value = sName
.Cells(2, i).Value = Range(sName & "!Database").Rows.Count
.Cells(3, i).Value = "=Sum(Range(sName & !sumPremiums))"
End With
i = i + 1
Else
...

It is the third .Cells-argument that causes my problem. Would be

happy
for
any solution.
--
Stef






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Creating a report by For Each...

Thanks Tom,
that made It!!

Stef

"Tom Ogilvy" wrote:

.Cells(3, i).Value =Application.Sum(Range(sName & "!sumPremiums"))

--
Regards,
Tom Ogilvy

"Stef" wrote in message
...
Actually, I want the sum of numbers in a column that I named "sumPremiums"

to
be placed in my report the same way I do with the other .Cells arguments.

So
the formula itself is not important, only the result from that

calculation.

Regards Stef

"Tom Ogilvy" wrote:

Assuming you want a formula like =Sum(Sheet1!sumPremiums)

where sumPremiums is a sheet level name:

.Cells(3, i).Value = "=Sum('" & sName & "'!sumPremiums)"

--
Regards,
Tom Ogilvy

"Stef" wrote in message
...
I gather information from various, named ranges, in a number of

worksheets
in
a specific workbook. I use a "For Each loop" to search in every sheet

for
values in defined ranges and then place that value in a summary

report.
This
works fine with one single value in that range. However, one of these
ranges,
a list, contains numbers that I want to sum up and place in the

report.

This is part of the code
...
Next rn
If rnExists = True Then
With totalSheet
On Error Resume Next
.Cells(1, i).Value = sName
.Cells(2, i).Value = Range(sName & "!Database").Rows.Count
.Cells(3, i).Value = "=Sum(Range(sName & !sumPremiums))"
End With
i = i + 1
Else
...

It is the third .Cells-argument that causes my problem. Would be

happy
for
any solution.
--
Stef






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
Creating an overdue report. AVCM New Users to Excel 2 October 1st 09 08:43 AM
Creating a Report Pat Excel Discussion (Misc queries) 1 March 15th 09 05:33 PM
Creating a report with .jpg files in it gregstorm@ Excel Discussion (Misc queries) 1 November 21st 07 02:54 PM
Creating a Report in Excel Liju George Excel Discussion (Misc queries) 2 March 8th 07 09:40 PM
Creating a Subset Report Bob Excel Worksheet Functions 2 November 13th 06 03:52 PM


All times are GMT +1. The time now is 10:44 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"