Macro to insert n rows in various worksheets

AHACK

New Member
Joined
Aug 26, 2014
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hi All, hope everyone had a good Christmas and NY.

My problem is that I have a large workbook with multiple sheets. At times users need to add 'n' rows at 20+ locations within the work book (eg sheet 1 has 2 locations, sheet 2 1 location etc). This is time consuming and prone to error, as people need to ensure they have added rows at every required sheet to ensure the cashflows line up.

I require two items:

Macro to insert x rows at various specific row locations across multiple sheets, dependent on a msg box request for number of rows from the user
As the rows are inserted it would also fill down only the formulas and formatting from the row immediately preceding the newly added row/s.

Second requirement, if possible would be if the macro could understand if rows have been added previously and update the starting points on each worksheet to take account of the previous row insertion. (if this is too much brain damage I could leave this out and mandate that users only add rows once as they are setting up the workbook for use)

(this is a property model that could have variable numbers of tenants, each with individual cashflows that need to be rolled up in various locations)

Apologies to all if this is asking alot.

Cheers

Hak
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
This could be done easily. The possibility of receiving a solution now lies in your ability to provide us with cell references, details like the sheet name, the amount of rows, and really just any general picture of what your data looks like.
 
Upvote 0
This could be done easily. The possibility of receiving a solution now lies in your ability to provide us with cell references, details like the sheet name, the amount of rows, and really just any general picture of what your data looks like.


Hi Sven, I have setup the work book with a worksheet to setup the various row positions etc. I thought this would be a good idea incase the worksheet changes. As it stops the need for people to access the VBA.

Example below. Each bold item (ex italic) are worksheets; each normal text item eg"Bottom" with a row number is the reference to the data area and row point for insertion of additional rows. My thought was that you create variables for each normal text items in VBA, the VBA variables are initially set by the original row numbers column. Once the Macro is run once, it outputs updated row numbers (ie Bottom - Original Row 13 + 10 rows in macro = Bottom - Updated Row 23). This way if the macro is run again it already has the updated starting points for the insertion of rows? Is this a dumb idea?

[TABLE="width: 417"]
<colgroup><col><col><col><col span="2"></colgroup><tbody>[TR]
[TD="colspan: 2"]VBA Control Rows[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Original Row[/TD]
[TD]Updated Row[/TD]
[/TR]
[TR]
[TD="colspan: 2"]Tenancy Sched
Bottom[/TD]
[TD][/TD]
[TD="align: right"]
13[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Physical[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Unit Hold Series[/TD]
[TD][/TD]
[TD="align: right"]17[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Area Series[/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Lease Type Series[/TD]
[TD][/TD]
[TD="align: right"]52[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Vacancy[/TD]
[TD][/TD]
[TD="align: right"]81[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]TS-Growth-Mkt[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] GF Market Rental Profile[/TD]
[TD][/TD]
[TD="align: right"]89[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]Property CFs[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Conracted Income[/TD]
[TD] [/TD]
[TD="align: right"]14[/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] Speculative Income 1st Term[/TD]
[TD][/TD]
[TD="align: right"]29[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Speculative Income 2nd Term[/TD]
[TD][/TD]
[TD="align: right"]44[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Speculative Income 3rd Term[/TD]
[TD][/TD]
[TD="align: right"]59[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Recoveries (All Terms)[/TD]
[TD][/TD]
[TD="align: right"]81[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Lease Fee[/TD]
[TD][/TD]
[TD="align: right"]112[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Make Good 1[/TD]
[TD][/TD]
[TD="align: right"]127[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Make Good 2[/TD]
[TD][/TD]
[TD="align: right"]143[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Make Good 3[/TD]
[TD][/TD]
[TD="align: right"]158[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Incentives 1[/TD]
[TD][/TD]
[TD="align: right"]173[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Incentives 2[/TD]
[TD][/TD]
[TD="align: right"]188[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD] Incentives 3[/TD]
[TD][/TD]
[TD="align: right"]203[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Sven, the data is generally numerical and formula based, some text. It is generally laid out across the page as a time series, IE a number of descriptive or input columns followed by a series of 120-240 monthly cashflows.

Sorry should have included that in the information previously submitted.

Cheers
 
Upvote 0
This could be done easily. The possibility of receiving a solution now lies in your ability to provide us with cell references, details like the sheet name, the amount of rows, and really just any general picture of what your data looks like.

Sven I have come up with the following to set the variable values (ie the row number of the spot where I would like the rows inserted).

Code:
Sub SetVarFromCell()
    Dim TenEnd As Long
    Dim PhyUnit As Long
    Dim PhyArea As Long
    Dim PhyLeaseT As Long
    Dim PhyVac As Long
    Dim TsgMkt As Long
    Dim PropCi As Long
    Dim PropSi1 As Long
    Dim PropSi2 As Long
    Dim PropSi3 As Long
    Dim PropLf As Long
    Dim PropMg1 As Long
    Dim PropMg2 As Long
    Dim PropMg3 As Long
    Dim PropIn1 As Long
    Dim PropIn2 As Long
    Dim PropIn3 As Long
   
      
TenEnd = Sheet25.Cells(8, "F").Value
PhyUnit = Sheet25.Cells(10, "F").Value
PhyArea = Sheet25.Cells(11, "F").Value
PhyLeaseT = Sheet25.Cells(12, "F").Value
PhyVac = Sheet25.Cells(13, "F").Value
TsgMkt = Sheet25.Cells(15, "F").Value
PropCi = Sheet25.Cells(17, "F").Value
PropSi1 = Sheet25.Cells(18, "F").Value
PropSi2 = Sheet25.Cells(19, "F").Value
PropSi3 = Sheet25.Cells(20, "F").Value
PropLf = Sheet25.Cells(21, "F").Value
PropMg1 = Sheet25.Cells(22, "F").Value
PropMg2 = Sheet25.Cells(23, "F").Value
PropMg3 = Sheet25.Cells(24, "F").Value
PropIn1 = Sheet25.Cells(25, "F").Value
PropIn2 = Sheet25.Cells(26, "F").Value
PropIn3 = Sheet25.Cells(27, "F").Value




End Sub

I presume that I can then feed this back into the next routine to set the row locations for the insertion of rows.

Cheers
 
Upvote 0
Hate to be a pain, but I would really recommend you download and install the Mr Excel HTML Maker from this link: http://www.mrexcel.com/forum/about-board/508133-attachments.html#post2545970

Follow the instructions to install it and use it to copy and paste your data into the forum. It will make it much easier to carry over from Excel and will look like this:


Book1
IJ
1EasilyReadable
2Data1123
3Data2456
Sheet1


Just looking at what you already posted, where did you get the 10 from, to add to the 13, for "bottom" ?
 
Upvote 0
Sorry Sven. First time I have really posted a problem. Normally I can find the answer.

Excel 2012
CDEFG
VBA Control Rows
Original RowUpdated Row
Tenancy Sched
End
Physical
Unit Hold Series
Area Series
Lease Type Series
Vacancy
TS-Growth-Mkt
GF Market Rental Profile
Property CFs
Conracted Income
Speculative Income 1st Term
Speculative Income 2nd Term
Speculative Income 3rd Term
Recoveries (All Terms)
Lease Fee
Make Good 1
Make Good 2
Make Good 3
Incentives 1
Incentives 2
Incentives 3

<tbody>
[TD="align: center"]5[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]14[/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]10[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]17[/TD]
[TD="align: right"][/TD]

[TD="align: center"]11[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]32[/TD]
[TD="align: right"][/TD]

[TD="align: center"]12[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]52[/TD]
[TD="align: right"][/TD]

[TD="align: center"]13[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]81[/TD]
[TD="align: right"][/TD]

[TD="align: center"]14[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]15[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]89[/TD]
[TD="align: right"][/TD]

[TD="align: center"]16[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]17[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]14[/TD]
[TD="align: right"][/TD]

[TD="align: center"]18[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]29[/TD]
[TD="align: right"][/TD]

[TD="align: center"]19[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]44[/TD]
[TD="align: right"][/TD]

[TD="align: center"]20[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]59[/TD]
[TD="align: right"][/TD]

[TD="align: center"]21[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]81[/TD]
[TD="align: right"][/TD]

[TD="align: center"]22[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]112[/TD]
[TD="align: right"][/TD]

[TD="align: center"]23[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]127[/TD]
[TD="align: right"][/TD]

[TD="align: center"]24[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]143[/TD]
[TD="align: right"][/TD]

[TD="align: center"]25[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]158[/TD]
[TD="align: right"][/TD]

[TD="align: center"]26[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]173[/TD]
[TD="align: right"][/TD]

[TD="align: center"]27[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]188[/TD]
[TD="align: right"][/TD]

[TD="align: center"]28[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"]203[/TD]
[TD="align: right"][/TD]

</tbody>

AuditVB

Sorry should have mentioned in my post. Using 10 was just assuming that I would create 10 new rows.

The Tenancy Schedule page looks like the following

Excel 2012
CDEFGHIJKLMN

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #002060"]Current Ten. Schedule / Contracted Income[/TD]
[TD="bgcolor: #002060, align: right"][/TD]
[TD="bgcolor: #002060, align: right"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]

[TD="align: center"]3[/TD]
[TD="bgcolor: #E2EFDA, align: center"]#[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Vacant? (1,0)[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Unit # / Level[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Start Unit[/TD]
[TD="bgcolor: #DDEBF7, align: center"]End Unit[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Area Type[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Area (SQM)[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Tenant[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Recov Type
N/G/SG[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Commence[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Expiry[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Current Rental (P.A)[/TD]

[TD="align: center"]4[/TD]
[TD="bgcolor: #E2EFDA, align: center"]1[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L1[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-17[/TD]
[TD="bgcolor: #D9D9D9, align: center"]OFFICE[/TD]
[TD="bgcolor: #D9D9D9, align: center"]100.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"]Test Tenant[/TD]
[TD="bgcolor: #D9D9D9, align: center"]G[/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-17[/TD]
[TD="bgcolor: #D9D9D9, align: center"]50,000[/TD]

[TD="align: center"]5[/TD]
[TD="bgcolor: #E2EFDA, align: center"]2[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L2[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]RETAIL[/TD]
[TD="bgcolor: #D9D9D9, align: center"]100.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-18[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]6[/TD]
[TD="bgcolor: #E2EFDA, align: center"]3[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L3[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]PARKING[/TD]
[TD="bgcolor: #D9D9D9, align: center"]10.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-19[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]7[/TD]
[TD="bgcolor: #E2EFDA, align: center"]4[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L4[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]STORAGE[/TD]
[TD="bgcolor: #D9D9D9, align: center"]1.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-20[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]8[/TD]
[TD="bgcolor: #E2EFDA, align: center"]5[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L5[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]COMMS[/TD]
[TD="bgcolor: #D9D9D9, align: center"]1.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-21[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]9[/TD]
[TD="bgcolor: #E2EFDA, align: center"]6[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L6[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]SIGNAGE[/TD]
[TD="bgcolor: #D9D9D9, align: center"]1.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-22[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]10[/TD]
[TD="bgcolor: #E2EFDA, align: center"]7[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L7[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]OTHER[/TD]
[TD="bgcolor: #D9D9D9, align: center"]1.00[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]1-Jan-15[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Dec-23[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]11[/TD]
[TD="bgcolor: #E2EFDA, align: center"]8[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L8[/TD]
[TD="bgcolor: #D9D9D9, align: center"]31-Jan-18[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]12[/TD]
[TD="bgcolor: #E2EFDA, align: center"]9[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L9[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]13[/TD]
[TD="bgcolor: #E2EFDA, align: center"]10[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"]L10[/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

[TD="align: center"]14[/TD]
[TD="bgcolor: #E2EFDA, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]
[TD="bgcolor: #D9D9D9, align: center"][/TD]

</tbody>
Tensch
 
Upvote 0
Hate to be a pain, but I would really recommend you download and install the Mr Excel HTML Maker from this link: http://www.mrexcel.com/forum/about-board/508133-attachments.html#post2545970

Follow the instructions to install it and use it to copy and paste your data into the forum. It will make it much easier to carry over from Excel and will look like this:

IJ

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="bgcolor: #8EA9DB, align: center"]Easily[/TD]
[TD="bgcolor: #8EA9DB, align: center"]Readable[/TD]

[TD="align: center"]2[/TD]
[TD="align: center"]Data1[/TD]
[TD="align: center"]123[/TD]

[TD="align: center"]3[/TD]
[TD="align: center"]Data2[/TD]
[TD="align: center"]456[/TD]

</tbody>
Sheet1



Just looking at what you already posted, where did you get the 10 from, to add to the 13, for "bottom" ?

I got this far Sven but I am not very good at this.

Code:
Option Explicit
    
    Public TenEnd As Long
    Public PhyUnit As Long
    Public PhyArea As Long
    Public PhyLeaseT As Long
    Public PhyVac As Long
    Public TsgMkt As Long
    Public PropCi As Long
    Public PropSi1 As Long
    Public PropSi2 As Long
    Public PropSi3 As Long
    Public PropLf As Long
    Public PropMg1 As Long
    Public PropMg2 As Long
    Public PropMg3 As Long
    Public PropIn1 As Long
    Public PropIn2 As Long
    Public PropIn3 As Long
    


Function SetRowInsertPosition() As Long
           
TenEnd = Sheet25.Cells(8, "F").Value
PhyUnit = Sheet25.Cells(10, "F").Value
PhyArea = Sheet25.Cells(11, "F").Value
PhyLeaseT = Sheet25.Cells(12, "F").Value
PhyVac = Sheet25.Cells(13, "F").Value
TsgMkt = Sheet25.Cells(15, "F").Value
PropCi = Sheet25.Cells(17, "F").Value
PropSi1 = Sheet25.Cells(18, "F").Value
PropSi2 = Sheet25.Cells(19, "F").Value
PropSi3 = Sheet25.Cells(20, "F").Value
PropLf = Sheet25.Cells(21, "F").Value
PropMg1 = Sheet25.Cells(22, "F").Value
PropMg2 = Sheet25.Cells(23, "F").Value
PropMg3 = Sheet25.Cells(24, "F").Value
PropIn1 = Sheet25.Cells(25, "F").Value
PropIn2 = Sheet25.Cells(26, "F").Value
PropIn3 = Sheet25.Cells(27, "F").Value






End Function


Sub InsertRow()
     
    Dim Rng As Long
    Dim lngA As Long
    Dim lngB As Long
   
   Call SetRowInsertPosition
        
    Application.ScreenUpdating = False
     
     
        
    Rng = InputBox("Enter number of rows required.")
     
    If Rng = 0 Then Exit Sub
     
       
     
    Sheet5.Activate
        Rows(TenEnd).Resize(Rng).Insert
        
               
       


    Application.ScreenUpdating = True
    
   
     
End Sub

Seems to insert the rows for TenEnd ok, however none of the formatting is carried down. I also cant work out how to fill any information/calcs down either?

Pretty happy considering before this morning I had not written any VBA.

Thanks
 
Upvote 0
I'm sorry, are you basically just trying to extend the range on sheet "Tensch" by X amount of rows? And fill down the formulas/formatting into these new rows? What would your expected results look like for entry "Conracted Income" in cell D17?
 
Upvote 0
I'm sorry, are you basically just trying to extend the range on sheet "Tensch" by X amount of rows? And fill down the formulas/formatting into these new rows? What would your expected results look like for entry "Conracted Income" in cell D17?

Morning Sven, the workbook has the following pages, all of which requires row insertion and filling down of the formula from above. (Pages requiring rows include; Tensch (tenancy schedule), Physical (indicators re vacancy etc), TS_Growth_Mkt (Series of Market Rents for each line on the tenancy schedule), Property CF's - This page requires rows to be inserted in at several different locations as can be seen on the Audit VB page highlighted previously.
The 'Original Row' reference matches the various rows on the worksheets where rows should be inserted.

See below for the Contacted Income section. I would expect that x rows would be added after row 31 and that formatting and formula would be copied down. (formula for O31 below). You will see that the formula refers to Tensch row 13, which is the last row of data on the tensch previously provided.

Excel 2012
DEFGHIJKLMNOPQ
Leave Blank for Insert Rows Macro

<tbody>
[TD="align: center"]19[/TD]
[TD="bgcolor: #002060, align: center"]x[/TD]
[TD="bgcolor: #FFFF00"]Conracted Income[/TD]
[TD="bgcolor: #FFFF00, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"]Date[/TD]
[TD="bgcolor: #002060, align: center"]31-Jan-16[/TD]
[TD="bgcolor: #002060, align: center"]29-Feb-16[/TD]
[TD="bgcolor: #002060, align: center"]31-Mar-16[/TD]

[TD="align: center"]20[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"]#[/TD]
[TD="bgcolor: #002060, align: center"]Tenant[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #002060, align: center"]1[/TD]
[TD="bgcolor: #002060, align: center"]2[/TD]
[TD="bgcolor: #002060, align: center"]3[/TD]

[TD="align: center"]21[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"]#[/TD]
[TD="bgcolor: #DDEBF7, align: center"]Tenant[/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]
[TD="bgcolor: #DDEBF7, align: center"][/TD]

[TD="align: center"]22[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]1[/TD]
[TD="bgcolor: #FFF2CC, align: center"]Test Tenant[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]4,167[/TD]
[TD="bgcolor: #FFF2CC, align: center"]4,167[/TD]
[TD="bgcolor: #FFF2CC, align: center"]4,167[/TD]

[TD="align: center"]23[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]2[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]24[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]3[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]25[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]4[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]26[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]5[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]27[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]6[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]28[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]7[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]29[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]8[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]30[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]9[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]31[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]10[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

[TD="align: center"]32[/TD]
[TD="bgcolor: #002060, align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]

</tbody>
Property CFs
Excel 2012
O

<colgroup><col style="width: 25pxpx"><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]31[/TD]
[TD="bgcolor: #FFF2CC, align: center"]0[/TD]

</tbody>
Property CFs

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]O31[/TH]
[TD="align: left"]=+IFERROR(IF(AND(O$19>=Tensch!$L13,O$19<=Tensch!$M13),1/12,0)*IF(O$19<=Tensch!$R13,Tensch!$N13,IF(O$19<=Tensch!$T13,Tensch!$S13,IF(O$19<=Tensch!$V13,Tensch!$U13,IF(O$19<=Tensch!$X13,Tensch!$W13,IF(O$19<=Tensch!$Z13,Tensch!$Y13,IF(O$19<=Tensch!$AB13,Tensch!$AA13,IF(O$19<=Tensch!$AD13,Tensch!$AC13,IF(O$19<=Tensch!$AF13,Tensch!$AE13,IF(O$19<=Tensch!$AH13,Tensch!$AG13,IF(O$19<=Tensch!$AJ13,Tensch!$AI13,IF(AND(O$19>Tensch!$AJ13,O$19<EOMONTH(Tensch!$AJ13,12)),Tensch!$AK13,IF(AND(O$19>=EOMONTH(Tensch!$AJ13,12),MONTH(Tensch!$AJ13)=MONTH(O$19)),N31*12*((Tensch!$AK13/Tensch!$AI13)),N31*12))))))))))))*O16,0)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top