Completely Stumped

  • Thread starter Thread starter ZimBoy
  • Start date Start date
Z

ZimBoy

Some kind souls help is requested to make my worksheet more user
friendly:

1) When data is filled in across cell range B14 – R14 and I then press
“enter”.... a new row is automatically inserted either above or
below.

2) The new row would retain the formulas in the cells just copied, but
none of the calculations or text. I am using using the following code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim lastrow As Long
lastrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
Rows(lastrow).AutoFill Rows(lastrow).Resize(2), xlFillDefault
Rows(lastrow + 1).SpecialCells(xlConstants).ClearContents

End Sub

All is well until I "Protect" the worksheet. I do this to limit tab
order and because other cells above cell range B14 - R14 must not be
erased or changed by mistake. If anyone is interested in looking at the
relevant portion of this worksheet please let me know.

"Thank you" ... in advance for any suggestions you might have.
 
Hi Zimboy

In your macro, just before you do the row insert, set worksheet protection
to false, and then, after doing your thing, set it to true again.

ActiveSheet.Unprotect
and then do your thing
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top