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: 80
Default Looping: Selecting elements from a named range to change calcs

Hi All.

I hope you can help.

I have a worksheet which is used to provide a number of reports in the same
format.

The values calculated depend elements selected in a cell from a validated
list, which is contained within a names range "Cost_Centre_Description".
There are 26 elements within the list.

When these selections are made manually and the worksheet only is
recalculated the figures are updated for the new cost centres data.

A print macro collapses grouped rows before printing the individual sheet.

I have generated the following Macro, by first recording and then editing.
I think that it can be shortened by first defining the named range as an
array and then using a for next loop to iterate the macro - but I cant get my
head around the syntax.

If someone could give me a couple hint I think that I could develop the
final code myself.

Thanks for looking
Regards
Phil

An extract of the code I have used is given below. 4 out of 26 elements are
shown.

Sub PrintPLDepartments()
'
' PrintPLDepartments Macro
' This macro is to sequentially print each of the elements
' in the list of cost centres
'Section 1 - Recalculates the Workbook and Selects the Report Type
Calculate
Application.Goto Reference:="ChosenReportType"
ActiveCell.FormulaR1C1 = "Profit Centre"
Range("C4").Select
'Section 2 - Repeated for each element in the report type.
'Element 1
Application.Goto Reference:="ChosenElementType"
ActiveCell.FormulaR1C1 = "Birmingham Retail"
Range("C6").Select
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Calculate
Application.Run "'Mgt accounts Master 2006
NEW.xls'!CollapseRowsB4Printing"
'Element 2
Application.Goto Reference:="ChosenElementType"
ActiveCell.FormulaR1C1 = "Birmingham Corporate Finance"
Range("C6").Select
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Calculate
Application.Run "'Mgt accounts Master 2006
NEW.xls'!CollapseRowsB4Printing"
'Element 3
Application.Goto Reference:="ChosenElementType"
ActiveCell.FormulaR1C1 = "East Lancs Retail"
Range("C6").Select
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Calculate
Application.Run "'Mgt accounts Master 2006
NEW.xls'!CollapseRowsB4Printing"
'Element 4
Application.Goto Reference:="ChosenElementType"
ActiveCell.FormulaR1C1 = "Cardiff 2 Retail"
Range("C6").Select
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Calculate
Application.Run "'Mgt accounts Master 2006
NEW.xls'!CollapseRowsB4Printing"
'Element 5

 
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
Problem selecting a named range kkknie[_180_] Excel Programming 0 August 11th 04 08:30 PM
Deleting named ranges by looping through range collection agarwaldvk[_11_] Excel Programming 3 August 3rd 04 01:00 AM
Further Help Req'd - Looping thru cells in named range Michael Beckinsale Excel Programming 4 September 2nd 03 08:18 PM
Looping thru cells in a named range Michael Beckinsale Excel Programming 4 September 2nd 03 02:07 PM
looping cells though a named range Jo[_4_] Excel Programming 1 August 20th 03 12:32 AM


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