How can i add rows based on cell value

iamangelicazxcv

New Member
Joined
Sep 7, 2018
Messages
3
Hi Excel masters,

I am trying to make a macro, How am I going to add rows like for example

Column C = Schedule lines

If C=3 it will automatically add 1 row
If C = 4 it should add 2 row

up until 10

some people saying it should be done backwards but i dont know how.

and also putting borders in all cells used without specific range

Can you guys pls help me?
So much love and thanks!

ANGIE
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Put this in sheet module (right-click on Sheet Tab \ View Code \ paste into the code that appears)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Target.Column = 3 Then Target.Offset(1).Resize(Target.Value).EntireRow.Insert
End Sub

If a number is entered in any cell in column C then the required number of rows are inserted immediately below
- so if 5 is entered in C2, then blank rows 3,4,5,6 & 7 inserted
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

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