Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KJL KJL is offline
external usenet poster
 
Posts: 5
Default help with defining column only from range of cells

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default help with defining column only from range of cells

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
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
Defining Named Range for Lastrow in a specific column Barb Reinhardt Excel Discussion (Misc queries) 5 May 9th 07 08:55 PM
Defining a range by the contents of cells? travis[_3_] Excel Programming 1 September 2nd 06 12:04 PM
Defining Range using Cells T De Villiers[_67_] Excel Programming 8 July 31st 06 09:24 AM
Defining Range of For Each Loop for Cells and Worksheets ExcelMonkey[_190_] Excel Programming 2 February 22nd 05 01:04 PM
defining an event procedure (lostfocus) that works on a column range juhlott Excel Programming 1 July 8th 04 08:26 PM


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