Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA: cannot figure out code
I am a novice to VBA and what I am trying to do I think is pretty simple but
I just don't know the code. On an excel spreadsheet I have a box where a user can enter data. The data includes two interest rates and 2 dates for each interest rate. One for when the interest rate will become effective and the other for when it will no longer be effective. I want to make a macro that will take the interest rate and dumpt it next to everypayment date that it will be effective for. Right now the excel sheet is a long list of payment dates with info like principal, interest, interest rate, etc.. The code that I wrote is using if statements to determine whether the payment date is between the two "effective dates". Anyway, here is the code I have come up with thus far. Much could be wrong and I may have over complicated things. Like I said I am a novice so there may be a much better way of doing this. Sub InputNewRates() Dim Baseint As String Dim FirstMOBase As Date Dim SecondMOBase As Date Dim FirstMOSwap As Date Dim SecondMOSwap As Date Dim SwapInt As String Dim Range As Range Dim rwindex As Integer Baseint = [N2].Value FirstMOBase = [n3].Value SecondMOBase = [n4].Value SwapInt = [n5].Value FirstMOSwap = [n6].Value SecondMOSwap = [n7].Value For rwindex = 12 To 84 Set Range = Range(rwindex, 2) For Each cel In Range If cel < FirstMOBase Then If cel SecondMOBase Then Set Range = Range(rwindex, 21) Set cel = Baseint End If End If Next Next End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can not figure out the code for the chart layout type I want | Charts and Charting in Excel | |||
HOW TO 'BLINK' A FIGURE INSTEAD OFF BOLDING THE FIGURE | Excel Worksheet Functions | |||
Unable to figure out VBA Code needed | Excel Programming | |||
Code to Save As, then Open - can't figure it out! | Excel Discussion (Misc queries) | |||
Can anyone figure this code problem please | Excel Discussion (Misc queries) |