Tuesday, December 30, 2014

How to insert rows or delete rows in a protected excel sheet

Hi,

While inserting row first you need to enter how many rows to be inserted & then select cell after which rows to be inserted..

For deleting row you will be prompted for selecting cell for which you need to delete rows.

'Macro for Inserting rows
Sub Insert_Row()
Dim n As Integer 'number of rows to insert
Dim rng As Range
n = Application.InputBox("How many rows you need to insert?", Type:=2)
Set rng = Application.InputBox("Select cell after which you want to insert row?", Type:=8)
ActiveSheet.Unprotect Password:="password"
rng.Select
rng.Resize(n, 1).EntireRow.Insert shift:=xlDown
ActiveSheet.Protect Password:="password"
End Sub
'Macro for Deleting rows
Sub Delete_Rows()
Dim rng As Range
ActiveSheet.Unprotect Password:="password"
Set rng = Application.InputBox("Select cell after which you want to insert row?", Type:=8)
rng.EntireRow.Delete
ActiveSheet.Protect Password:="password"
End Sub

1 comment:

  1. Since Slots.lv ranked on the prime of our listing, let’s take a look at|check out} the short course of of making an account with them and claiming the bonus codes. For instance, if you receive a $50 deposit bonus with a 10x wagering requirement, you have to bet 10 instances the bonus quantity to safe the bonus, which might be $500. Red Dog Casino provides extra to their gamers in addition to an lovable doggie mascot, together with a valuable welcome package worth a lot as} a whopping $12,250. If would possibly be} funding your account with cryptocurrency, use the promo code SLBWB300 for a 300% match up to as} $1,500. If it's your first time withdrawing, you will also must verify your identification or submit other required documentation. Some 온라인카지노 casinos additionally only allow withdrawals to the identical technique used for deposits, so make sure you|ensure you|be sure to} know the foundations of your on line casino.

    ReplyDelete