Copy Formula from Cell 200 of that column into deleted Cell - VB

eli_m

Board Regular
Joined
Jun 2, 2022
Messages
129
Office Version
  1. 365
Platform
  1. Windows
Hi - This site has helped me so much I thought I'd sign up and ask my own question and hopefully help others :)

My question:
What would be the VB code for when I delete data from a cell it then automatically copies the formula that's in cell 200 of that row into the newly deleted cell?

eg.

1. Delete data in cell A1
2. Formula from A200 gets put into cell A1

I also want it to work for all my columns which is A to AR.

Another example:

1. Delete data from F68
2. Formula from F200 populates into F68

Any help would be greatly appreciated!

Thank you in advance
 
Could it be that that cell, or some or all of column AH is formatted as a Date?
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Could it be that that cell, or some or all of column AH is formatted as a Date?
I think thats exactly it! I think sometimes I overwrite the cell with a Copy/Paste with another format.
These accidents will always happen so is there a way to adjust the code to account for this?
 
Upvote 0
These accidents will always happen so is there a way to adjust the code to account for this?
This should stop the code from erroring in that circumstance (but it doesn't stop the circumstance of a large number being put into a date-formatted cell happening)

Rich (BB code):
If IsEmpty(c.Value) Then Cells(200, c.Column).Copy Destination:=c
If Len(c.Text) = 0 Then Cells(200, c.Column).Copy Destination:=c
 
Upvote 0
This should stop the code from erroring in that circumstance (but it doesn't stop the circumstance of a large number being put into a date-formatted cell happening)

Rich (BB code):
If IsEmpty(c.Value) Then Cells(200, c.Column).Copy Destination:=c
If Len(c.Text) = 0 Then Cells(200, c.Column).Copy Destination:=c

Thanks so much :) I will give it a go and report back if the other users of the spreadsheet receive anymore errors
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,729
Members
449,049
Latest member
MiguekHeka

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