Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Absolute to Relative Referencing

Hi All,

I have the following code which inserts a sum formula in the
activecell.

Dim startRow As Integer
Dim startCell As Range, endCell As Range
startRow = 2
With ActiveCell
Set startCell = Cells(startRow, .Column - 1)
Set endCell = .Offset(0, -12)
..Formula = "=SUM( " & startCell.Address & ":" & endCell.Address & ")"

My problem is that the sum formula is created with absolute
references.
I need the formula to be created with relative references for both the
rows
and the columns.

Any ideas on how to change from absolute to relative referencing?

Thanks,

Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Absolute to Relative Referencing

Hi sgltaylor,

..Formula = "=SUM( " & Replace(startCell.Address, "$", "") & ":" & Replace(endCell.Address, "$", "") & ")"

--
Cheers
macropod
[Microsoft MVP - Word]


"sgltaylor" wrote in message ...
Hi All,

I have the following code which inserts a sum formula in the
activecell.

Dim startRow As Integer
Dim startCell As Range, endCell As Range
startRow = 2
With ActiveCell
Set startCell = Cells(startRow, .Column - 1)
Set endCell = .Offset(0, -12)
.Formula = "=SUM( " & startCell.Address & ":" & endCell.Address & ")"

My problem is that the sum formula is created with absolute
references.
I need the formula to be created with relative references for both the
rows
and the columns.

Any ideas on how to change from absolute to relative referencing?

Thanks,

Steve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Absolute to Relative Referencing

startCell.Address(false,false)

etc.

Tim


"sgltaylor" wrote in message
...
Hi All,

I have the following code which inserts a sum formula in the
activecell.

Dim startRow As Integer
Dim startCell As Range, endCell As Range
startRow = 2
With ActiveCell
Set startCell = Cells(startRow, .Column - 1)
Set endCell = .Offset(0, -12)
.Formula = "=SUM( " & startCell.Address & ":" & endCell.Address & ")"

My problem is that the sum formula is created with absolute
references.
I need the formula to be created with relative references for both the
rows
and the columns.

Any ideas on how to change from absolute to relative referencing?

Thanks,

Steve



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Absolute to Relative Referencing

On Nov 30, 5:11*pm, "Tim Williams" wrote:
startCell.Address(false,false)

etc.

Tim

"sgltaylor" wrote in message

...



Hi All,


I have the following code which inserts a sum formula in the
activecell.


Dim startRow As Integer
Dim startCell As Range, endCell As Range
startRow = 2
With ActiveCell
Set startCell = Cells(startRow, .Column - 1)
Set endCell = .Offset(0, -12)
.Formula = "=SUM( " & startCell.Address & ":" & endCell.Address & ")"


My problem is that the sum formula is created with absolute
references.
I need the formula to be created with relative references for both the
rows
and the columns.


Any ideas on how to change from absolute to relative referencing?


Thanks,


Steve- Hide quoted text -


- Show quoted text -


Thank you both for taking the time to respond.
Your suggestions worked great.
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
Relative vs Absolute referencing of Workbooks Ronald Dodge Excel Worksheet Functions 4 September 26th 06 10:34 PM
Relative vs Absolute referencing of Workbooks Ronald Dodge Charts and Charting in Excel 4 September 26th 06 10:34 PM
Relative vs Absolute referencing of Workbooks Ronald Dodge Excel Programming 4 September 26th 06 10:34 PM
Absolute/Relative Referencing & Buttons! Angela Excel Programming 2 May 26th 05 06:19 AM
missing macro absolute/relative referencing toolbar Alex[_20_] Excel Programming 2 March 2nd 04 05:48 PM


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