How do I make this code shorter? Its Result should be given to var
Dana,
I did say it was Jay's lucky day. <g
--
Jim Cone
Portland, Oregon USA
"Dana DeLouis"
wrote in message
How do I make this code shorter?
Would this work?
Sub Try()
Dim Rw As Long
Dim Cl As Long
Dim C As Long
Dim Valid As Boolean
With ActiveCell
Rw = .Row
Cl = .Column
End With
Valid = Rw = 2 And Rw <= 12 And _
Cl = 2 And Cl <= 22
If Not Valid Then Exit Sub
'// Get new column
C = 3 * Int((Cl + 4) / 3) - 2
'// Fill in Formula down to row 12
Range(Cells(Rw, C), Cells(12, C)).FormulaR1C1 = "=RC[-2]+RC[-1]"
End Sub
= = =
HTH
Dana DeLouis
|