Friday, March 8, 2013

VBA: Bond Valuation II

In our class discussion, the prof taught me a different way of coding using the record macro and worksheets.

  • Made me think it will be helpful in creating excel sheet forms and output data.
  • Discovered ActiveCell.Offset(r,c)

Here's the code:


Sub Macro3()

For i = 1 To 108

Application.ScreenUpdating = False

Sheets("DATA Process").Select
Range("A1").Select

'dito ka lng nagloop and it works for all
ActiveCell.Offset(i, 0).Range("A1:E1").Select
Selection.Copy

Sheets("Scratch").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

Range("F15").Select
Selection.Copy

Sheets("DATA Process").Select
ActiveCell.Offset(0, 6).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

Next i

End Sub

No comments:

Post a Comment