ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Insert Row with formula (https://www.excelbanter.com/excel-discussion-misc-queries/183160-insert-row-formula.html)

RKS

Insert Row with formula
 
Hi All,
I have protected excel sheet which have many column and row. I can
distribute to user
and uer can fill data. after some time, some data are useless so user want
delete and
insert new row (with formula). i can hide all formula which i can use in
this excel sheet.

I can use micro for insert line, so user can insert. but problem is that
when line inset its blank
and no formula is coping which i can use previous column and row. I want
when Insert row its insert with all formula.
please help me.

micro which i can use:

Private Sub Workbook_Open()
Application.OnKey "+{INSERT}", "ThisWorkbook. InsSelectedRow"
End Sub

Sub InsSelectedRow()
With Worksheets("T&A")
If Selection.Parent.Name = .Name Then
'check to make sure a row is selected
If Selection.Rows.Count = 1 And Selection.Cells.Count = 256 Then
.Unprotect Password:="xxx"
Selection.Insert
.Protect Password:="xxx"
End If
End If
End With
End Sub

RKS


Dave Peterson

Insert Row with formula
 
Maybe you can look at how David McRitchie did it and incorporate his technique:

http://www.mvps.org/dmcritchie/excel/insrtrow.htm
look for: InsertRowsAndFillFormulas

RKS wrote:

Hi All,
I have protected excel sheet which have many column and row. I can
distribute to user
and uer can fill data. after some time, some data are useless so user want
delete and
insert new row (with formula). i can hide all formula which i can use in
this excel sheet.

I can use micro for insert line, so user can insert. but problem is that
when line inset its blank
and no formula is coping which i can use previous column and row. I want
when Insert row its insert with all formula.
please help me.

micro which i can use:

Private Sub Workbook_Open()
Application.OnKey "+{INSERT}", "ThisWorkbook. InsSelectedRow"
End Sub

Sub InsSelectedRow()
With Worksheets("T&A")
If Selection.Parent.Name = .Name Then
'check to make sure a row is selected
If Selection.Rows.Count = 1 And Selection.Cells.Count = 256 Then
.Unprotect Password:="xxx"
Selection.Insert
.Protect Password:="xxx"
End If
End If
End With
End Sub

RKS


--

Dave Peterson


All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com