LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default How do I make this code shorter? Its Result should be given to

Hey thanks this is the exact one ,Im trying to modify the values of this code
"C = Cl + 2 - (Cl + 1) Mod 3" so it will compute after 3 columns. but I cant
get the exact value. Need help thanks.

Jay


"Dana DeLouis" wrote:

C = 3 * Int((Cl + 4) / 3) - 2


Slightly better might be just an offset equation...

Sub Try2()
Dim Rw As Long
Dim Cl As Long
Dim C As Long

Rw = ActiveCell.Row
Cl = ActiveCell.Column

If Not (Rw = 2 And Rw <= 12 And _
Cl = 2 And Cl <= 22) Then Exit Sub

'// Offset by 2,1,or 0
C = Cl + 2 - (Cl + 1) Mod 3

'// Fill in Formula down to row 12
Range(Cells(Rw, C), Cells(12, C)).FormulaR1C1 = "=RC[-2]+RC[-1]"
End Sub

- - -
HTH :)
Dana DeLouis

 
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
Can I Make This Computation Shorter? Steve[_8_] Excel Discussion (Misc queries) 22 October 28th 07 08:11 PM
Shorter Code Sandy Excel Programming 2 July 7th 07 08:47 PM
How to make a contingent formula shorter... phooey Excel Discussion (Misc queries) 10 January 5th 07 06:04 PM
I wonder if you can make this shorter T Excel Worksheet Functions 0 December 23rd 04 08:47 PM
Shorter code Stu[_13_] Excel Programming 13 September 29th 03 11:27 PM


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