• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

INSERT MULTIPLE ROW IN EXCEL IN ONE COMMAND

SAMRAT

New Member
I WANT TO INSERT MULTIPLE ROW IN EXCEL SHEET AT THE WHERE CONTAIN SOME TEXT IN ONE CLICK ( AND ALSO I WANT DIFFERENT NUMBERS OF ROWS AT DIFFERENT PLACE IN EXCEL TO BE INSERT)


I WANT TO DO FOLLOWING THING IN ONE CLICK IN EXCEL SHEET


WHERE CONTAIN NishiLand INSERT 7 ROW

WHERE CONTAIN White House INSERT 6 ROW

WHERE CONTAIN Raigad Resorts INSERT 25 ROW

WHERE CONTAIN Jai Hills Resorts INSERT 47 ROW

WHERE CONTAIN Aayush Resorts INSERT 65 ROW

WHERE CONTAIN Uncles Kitchen INSERT 15 ROW

WHERE CONTAIN Yudor Retreat INSERT 2 ROW

WHERE CONTAIN Durushet/Sajan INSERT 8 ROW

WHERE CONTAIN Tunnel Top INSERT 42 ROW

WHERE CONTAIN Mount View INSERT 13 ROW

WHERE CONTAIN Rishi / Woods INSERT 56 ROW

WHERE CONTAIN Shalom Resorts INSERT 85 ROW

WHERE CONTAIN Kamath Daba INSERT 14 ROW

WHERE CONTAIN Vishranti Resorts INSERT 31 ROW
 
First, please turn off your CAPS lock. It looks like you're yelling, and it's hard to read.


As there appears to be no given logic/reason for how many rows you want to insert, you may just have to do it manually. To insert more than 1 row at a time, select the number of rows you want, and then do an Insert. E.g, to insert 3 rows after row 2, select rows 3:5, and then Insert rows.

If you were wanting some sort of macro, we'd need to know at least where these cells are. Are they in column A? Are they always capitalised? Does the spacing change? Taking a wild guess at the macro, and not counting for upper/lower case differences:

[pre]
Code:
Sub InsertRows()
Dim LastRow As Integer
Dim i As Integer
Dim x As Integer
Application.ScreenUpdating = False
LastRow = Range("A65536").End(xlUp).Row

For i = LastRow To 1 Step -1
Select Case Cells(i, "A").Value
Case "NishiLand"
x = 7
Case "White House"
x = 6
Case "Raigad Resorts"
x = 25
Case "Jai Hills Resorts"
x = 47
Case "Aayush Resorts"
x = 65
Case "Uncles Kitchen"
x = 15
Case "Yudor Retreat"
x = 2
Case "Durushet/Sajan"
x = 8
Case "Tunnel Top"
x = 42
Case "Mount View"
x = 13
Case "Rishi / Woods"
x = 56
Case "Shalom Resorts"
x = 85
Case "Kamath Daba"
x = 14
Case "Vishranti Resorts"
x = 31
Case Else
x = 0
End Select

If x > 0 Then
Range(Cells(i + 1, "A"), Cells(i + 1 + x, "A")).EntireRow.Insert
End If
Next i

Application.ScreenUpdating = False

End Sub
[/pre]
 
Back
Top