Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JBW JBW is offline
external usenet poster
 
Posts: 42
Default How to index every line

I have the following code which uses myval to calculate correct number of
times to carry out function on sheet.

ActiveSheet.Name = "BB SCM " & FormatDateTime(Date, vbLongDate)



myVal = Application.CountIf(ActiveSheet.Cells, "NPQ") - 1


Range("Q6").Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE(IF(RC[-13]:RC[-2]0,RC[-13]:RC[-2],RC[-13]))"
Range("Q6").Select
Selection.FormulaArray = _
"=AVERAGE(IF(RC[-13]:RC[-2]0,RC[-13]:RC[-2],RC[-13]))"


Dim counter As Integer

For counter = 1 To myVal


Cells(6 + (counter * 8), 17).Select
ActiveCell.FormulaR1C1 = _
"=AVERAGE(IF(RC[-13]:RC[-2]0,RC[-13]:RC[-2],RC[-13]))"
Cells(6 + (counter * 8), 17).Select
Selection.FormulaArray = _
"=AVERAGE(IF(RC[-13]:RC[-2]0,RC[-13]:RC[-2],RC[-13]))"



Range("A6").Select
ActiveCell.FormulaR1C1 = "Stk Wk"
Range("B6").Select
ActiveCell.FormulaR1C1 = "=IF(RC[15]0,R[-1]C[2]/RC[15],""NF"")"
Range("B6").Select
Selection.NumberFormat = "0.0"


Cells(6 + (counter * 8), 1).Select
ActiveCell.FormulaR1C1 = "Stk Wk"
Cells(6 + (counter * 8), 2).Select
ActiveCell.FormulaR1C1 = "=IF(RC[15]0,R[-1]C[2]/RC[15],""NF"")"
Cells(6 + (counter * 8), 2).Select
Selection.NumberFormat = "0.0"

Range("Q1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Fc ave"



Next counter



Sheets.Add
Sheets("Sheet1").Select
Sheets.Add
Sheets.Add
Sheets.Add
Sheets.Add
Sheets.Add
Sheets.Add
Sheets("Sheet5").Select
Sheets("Sheet5").Name = "FC v Actual"
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "Print Plan"
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "No Forecast"
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Code Missing"
Sheets("Sheet6").Select
Sheets("Sheet6").Name = "Refers"
Sheets("Sheet7").Select
Sheets("Sheet7").Name = "Stock by code"






End Sub

I need to use same method to index across cell data to another sheet and be
sure using myvl that I take every line reardless of how mnay are in report
(it varies week to week).

I have two problems.

1. How do I select the sheet named BB SCM + date without using its 'name' as
this will change every day.

2 and how can I get it to use =index(sheet reference! A:A, (row()-1)*8+2) on
the 'print plan' sheet for the myval number of times.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default How to index every line

To Select a sheet whose name changes frequently, just insure the sheet has an
unchanged position w.r.t the other sheets and:

Sub ordinate()
Sheets(1).Select
End Sub

--
Gary''s Student - gsnu200750
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
Chart axes color index vs font color index [email protected] Charts and Charting in Excel 4 December 7th 06 04:05 PM
Make a line in a bar chart, and change color of any bars that exceed the line MarkM Excel Discussion (Misc queries) 4 July 5th 06 04:06 PM
How do I pull the col. index value as well as row index value Vikram Dhemare Excel Discussion (Misc queries) 1 March 29th 06 07:48 AM
coloring overy other line without doing so line by line gen Excel Worksheet Functions 5 April 1st 05 10:38 PM
How do I "index" data in a line graph? ShirleyJL Charts and Charting in Excel 2 January 10th 05 10:06 PM


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