Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the following code the sales1fieldiamt is based on a specific cell.
I have it so the rows are incrementing the way I need but I have to increment the column starting with the cell reference from the range as shown below. So instead of ("d" & iPivotRowSales) I need to have the column be the column from FirstCellRef (or Refa). (FirstCellRef=R5C40 or Refa=AN5) If someone could help me with this that would be great. Thanks iPivotRowSales = 7 With Worksheets("Sales Summary").Range("D5:AV5") Set PivotPeriod = .Find(2, LookIn:=xlValues) If PivotPeriod < Period Then Do Until PivotPeriod = Period FirstCellRef = PivotPeriod.Address(ReferenceStyle:=xlR1C1) FirstCellRefa = PivotPeriod.Address Set PivotPeriod = .FindNext(PivotPeriod) Loop iColumn = Val(Right(FirstCellRef, 2)) ' End If End With sales1fieldiamt = Worksheets("sales summary").Range("d" & iPivotRowSales).Value |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could you go:
Dim MyColumn as Long iPivotRowSales = 7 With Worksheets("Sales Summary").Range("D5:AV5") Set PivotPeriod = .Find(2, LookIn:=xlValues) If PivotPeriod < Period Then Do Until PivotPeriod = Period FirstCellRef = PivotPeriod.Address(ReferenceStyle:=xlR1C1) MyColumn = PivotPeriod.Column FirstCellRefa = PivotPeriod.Address Set PivotPeriod = .FindNext(PivotPeriod) Loop iColumn = Val(Right(FirstCellRef, 2)) ' End If End With sales1fieldiamt = Worksheets("sales summary").Cells(iPivotRowSales,MyColumn).Value Scott KJL wrote: In the following code the sales1fieldiamt is based on a specific cell. I have it so the rows are incrementing the way I need but I have to increment the column starting with the cell reference from the range as shown below. So instead of ("d" & iPivotRowSales) I need to have the column be the column from FirstCellRef (or Refa). (FirstCellRef=R5C40 or Refa=AN5) If someone could help me with this that would be great. Thanks iPivotRowSales = 7 With Worksheets("Sales Summary").Range("D5:AV5") Set PivotPeriod = .Find(2, LookIn:=xlValues) If PivotPeriod < Period Then Do Until PivotPeriod = Period FirstCellRef = PivotPeriod.Address(ReferenceStyle:=xlR1C1) FirstCellRefa = PivotPeriod.Address Set PivotPeriod = .FindNext(PivotPeriod) Loop iColumn = Val(Right(FirstCellRef, 2)) ' End If End With sales1fieldiamt = Worksheets("sales summary").Range("d" & iPivotRowSales).Value |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Defining Named Range for Lastrow in a specific column | Excel Discussion (Misc queries) | |||
Defining a range by the contents of cells? | Excel Programming | |||
Defining Range using Cells | Excel Programming | |||
Defining Range of For Each Loop for Cells and Worksheets | Excel Programming | |||
defining an event procedure (lostfocus) that works on a column range | Excel Programming |