Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Macro creates formula with $ absolute. I want to drop the $

I've got this

LastRow = Cells(Rows.Count, "H").End(xlUp).Row
Set rng = Range("H2:H" & LastRow)
ActiveCell.Formula = "=SUBTOTAL(9," & rng.Address & ")"

Which gives me this on the spreadsheet:
=SUBTOTAL(9,$H$2:$H$1122)

But I want this:
=SUBTOTAL(9,H2:H1122)

How do I stop the $?





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macro creates formula with $ absolute. I want to drop the $

ActiveCell.Formula = "=SUBTOTAL(9," & rng.Address(0,0,xlA1,False) & ")"

--
Regards,
Tom Ogilvy


"Aaron" wrote:

I've got this

LastRow = Cells(Rows.Count, "H").End(xlUp).Row
Set rng = Range("H2:H" & LastRow)
ActiveCell.Formula = "=SUBTOTAL(9," & rng.Address & ")"

Which gives me this on the spreadsheet:
=SUBTOTAL(9,$H$2:$H$1122)

But I want this:
=SUBTOTAL(9,H2:H1122)

How do I stop the $?





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 256
Default Macro creates formula with $ absolute. I want to drop the $

In Excel 2003 or earlier, as soon as you start recording, the macro
recorder toolbar floats out on the screen. Next to the Stop button,
there's a toggle button for relative references - when toggled on,
macro recorder will use relative references.

In Excel 2007, this option appears in the Code group of the Developer
tab.


On Jul 7, 5:32 pm, Tom Ogilvy
wrote:
ActiveCell.Formula = "=SUBTOTAL(9," & rng.Address(0,0,xlA1,False) & ")"

--
Regards,
Tom Ogilvy



"Aaron" wrote:
I've got this


LastRow = Cells(Rows.Count, "H").End(xlUp).Row
Set rng = Range("H2:H" & LastRow)
ActiveCell.Formula = "=SUBTOTAL(9," & rng.Address & ")"


Which gives me this on the spreadsheet:
=SUBTOTAL(9,$H$2:$H$1122)


But I want this:
=SUBTOTAL(9,H2:H1122)


How do I stop the $?- Hide quoted text -


- Show quoted text -



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
F4 no longer automatically creates absolute reference molla Excel Worksheet Functions 2 June 5th 10 01:23 AM
Macro creates two graphs instead of one? et10yl Excel Programming 1 October 19th 06 07:32 PM
VBA Code, My excel macro creates the charts on top of each other osman[_5_] Excel Programming 3 July 24th 06 09:53 PM
How to Rename a Blank Sheet that a macro Creates Darin Kramer Excel Programming 3 December 6th 04 12:55 PM
Macro that creates a directory but... Andy Excel Programming 7 November 28th 04 06:23 AM


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