Formula being deleted

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a spreadsheet that has a table in it with a formula in a hidden column for the table. I have a button to delete the records but if the row is highlighted and delete button pressed on the keyboard, the formula in the hidden column will be deleted. Is there a way I can add some vba code to insert the formula back in to each row within the table in column C?

The variables are:
Formula in column C in the table: =IF(A11="","",IF(COUNTIF(Sheet2!$G$87:$DO$97,A11),"Public_holiday",IF(WEEKDAY(A11)=1,"Sun",IF(WEEKDAY(A11)=7,"Sat","Business_day_rate"))))

Table name: css_quote

The formula does what is needed, I just need to know a way of making the formula get put back in if someone selects a row and presses delete on the keyboard instead of using the special buttons I have made.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Why not protect the sheet to not allow row / column deletion.
Incorporate the protect / unprotect into your button code
 
Upvote 0

Forum statistics

Threads
1,214,891
Messages
6,122,105
Members
449,066
Latest member
Andyg666

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