Using macro to copy row above just formulas and leave everything else blank

Chubba

New Member
Joined
Jul 12, 2011
Messages
20
Office Version
  1. 2010
Platform
  1. Windows
Hi

I have a table of data which contains formulas in some columns and others are free text fields that users can input whatever they want. I wanted to protect the formulas from modification or accidental deletion so I can use the Protect Sheet function but leaving the free text field unlocked. Users need to be able to insert/create new rows into the bottom of that table with the same formulas. I've managed to do this by setting this table as a defined table so whenever a new row is inserted, the formulas are automatically copied into the new row. I was then able to create a macro to unlock the sheet, insert the new row and then protect the sheet again.

However, I now want to share the workbook so that multiple users can edit at the same time but it says tables are not compatible with shared workbooks and the table must be converted to a range instead first.

This is my current macro
VBA Code:
Sub InsertNewRow()

Dim ws As Worksheet
Dim tbl As ListObject

Set ws = ActiveSheet
Set tbl = ws.ListObjects("Table1")

Sheets("Sheet1").Unprotect
tbl.ListRows.Add
Sheets("Sheet1").Protect

End Sub

How can I tweak the macro so that it does the above but no longer on a defined table?

Many thanks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top