I have a model that calculates Lease NERs (Net Effective Rent) for potential new leases. I am attempting to write a code that will plug in values from a data table (Sheet3) to the input tab (sheet1), calculate, then paste resulting values from the input page in the data table.
So far my code looks as follows:
BeginRow = 5
Endrow = 6
ChkCol = 2
For RowCnt = BeginRow To Endrow
If Cells(RowCnt, ChkCol).Value <> "" Then
'New Lease
Worksheets("Sheet1").Range("C28").Value = Worksheets("Sheet3").Cells(RowCnt, 13).Value
Worksheets("Sheet1").Range("C29").Value = Worksheets("Sheet3").Cells(RowCnt, 16).Value
Worksheets("Sheet1").Range("C34").Value = Worksheets("Sheet3").Cells(RowCnt, 19).Value
Worksheets("Sheet1").Range("C36").Value = Worksheets("Sheet3").Cells(RowCnt, 25).Value
Worksheets("Sheet1").Range("C30").Value = Worksheets("Sheet3").Cells(RowCnt, 31).Value
Worksheets("Sheet1").Range("C27").Value = Worksheets("Sheet3").Cells(RowCnt, 34).Value
Worksheets("Sheet1").Calculate
Worksheets("Sheet3").Cells(RowCnt, 40).Value = Worksheets("Sheet1").Range("H28").Value
'Lease Renewal
Worksheets("Sheet1").Range("C28").Value = Worksheets("Sheet3").Cells(RowCnt, 13).Value
Worksheets("Sheet1").Range("C29").Value = Worksheets("Sheet3").Cells(RowCnt, 16).Value
Worksheets("Sheet1").Range("C34").Value = Worksheets("Sheet3").Cells(RowCnt, 22).Value
Worksheets("Sheet1").Range("C36").Value = Worksheets("Sheet3").Cells(RowCnt, 28).Value
Worksheets("Sheet1").Range("C30").Value = Worksheets("Sheet3").Cells(RowCnt, 31).Value
Worksheets("Sheet1").Range("C27").Value = Worksheets("Sheet3").Cells(RowCnt, 37).Value
Worksheets("Sheet1").Calculate
Worksheets("Sheet3").Cells(RowCnt, 41).Value = Worksheets("Sheet1").Range("H28").Value
End If
Next RowCnt
I want the formula to run through plugging in the row numbers so that I don't have to write a new set for each row in the table.
Thank you in advance for the help!
Bookmarks