View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default How do I make this code shorter? Its Result should be given tovar

How do I make this code shorter?

Maybe not as clear, but...

Sub Try4()
Dim R As Long
Dim C As Long

R = ActiveCell.Row
C = ActiveCell.Column

If Not (R = 2 And R <= 12 And _
C = 2 And C <= 22) Then Exit Sub

'// Fill in Formula down to row 12
Cells(R, C + 2 - (C + 1) Mod 3).Resize(12 - R + 1) = "=RC[-2]+RC[-1]"
End Sub


= = =
HTH :)
Dana DeLouis