LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Colin Vicary
 
Posts: n/a
Default Using a variable in a VBA formula


Hi all

I have a worksheet tht contains year to date sales and sales for last
year. I want to show those sales as "last year to date". This means I
have to know how far through the year we are!

I've set a variable to get that, but now I want to add it to the
formula in the macro.

I've tried this but it's wrong, can anyone tell me how to make it
right?

Thanks

Colin

Dim Mon As Integer
Mon = Month(today) - 1
ActiveCell.FormulaR1C1 = "=SUM(RC[(Mon-12)]:RC[-5])"


--
Colin Vicary
------------------------------------------------------------------------
Colin Vicary's Profile: http://www.excelforum.com/member.php...o&userid=10472
View this thread: http://www.excelforum.com/showthread...hreadid=483067

 
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
use a variable array in a formula JPderose Excel Discussion (Misc queries) 1 October 20th 05 06:24 AM
Hide formula skateblade Excel Worksheet Functions 10 October 15th 05 08:36 PM
Refrencing a variable cell in a formula C Brehm Excel Discussion (Misc queries) 2 October 10th 05 03:30 PM
Variable Sheet Name in Formula Barb R. Excel Discussion (Misc queries) 5 July 6th 05 06:20 PM
Cell doesn't show formula result - it shows formula (CTRL + ' doe. o0o0o0o Excel Worksheet Functions 6 November 19th 04 03:13 PM


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