Add blank rows based on the value in a cell.

Closed
Kritika Dixit Posts 1 Registration date Saturday 1 February 2014 Status Member Last seen 1 February 2014 - 1 Feb 2014 à 02:38
mdazgt Posts 8 Registration date Monday 14 July 2014 Status Member Last seen 19 July 2014 - 15 Jul 2014 à 11:05
Hello,

How to add blank rows based on the value in a cell.


Say if value in cell is 9, then 9 number of blank rows to be entered automatically.



3 responses

venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 811
1 Feb 2014 à 06:54
Suppose your data is like this (in A1,a2,a3)
1
2
3
Then right click TAB of the sheet and click view code.
In the window that comes up copy this code. Save the file


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim j As Integer
If Target.Column <> 1 Then Exit Sub
If Target = "" Then Exit Sub

Application.EnableEvents = False
j = Target
Range(Target.Offset(1, 0), Target.Offset(j, 0)).EntireRow.Insert
Application.EnableEvents = True
MsgBox "done"


End Sub
Now select any one of A1,a2 or a3 see what happens
mdazgt Posts 8 Registration date Monday 14 July 2014 Status Member Last seen 19 July 2014
15 Jul 2014 à 10:53
this empty rows can be done by small resharch with menus in excel data sheet or an
xls file
mdazgt Posts 8 Registration date Monday 14 July 2014 Status Member Last seen 19 July 2014
15 Jul 2014 à 11:05
this empty rows can be done by small resherch with menus in excel sheet or an xls file

you can exceed the row next by the same option

or else

many more times empty rows by the same opyion