Deleting cells based on cell value of samerow
Solved/Closed
Related:
- Deleting cells based on cell value of samerow
- Excel macro to create new sheet based on value in cells - Guide
- If cell contains date then return value ✓ - Excel Forum
- Based on the values in cells b77 ✓ - Excel Forum
- Excel "IF" function w/ date in test cell ✓ - Excel Forum
- Excel formula to check if cell contains a date - Excel Forum
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
May 17, 2010 at 09:56 AM
May 17, 2010 at 09:56 AM
Use the sheet event
Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
End Sub
May 20, 2010 at 09:12 AM
By your answer I figured that you thought I should be able to come with the answer myself. So I looked throught the codes you have given me and found the loop code I discarded before. I have adjusted it and it works fine. For those reading this post and like to see the code here it is:
Thanks and best regards,
Trowa
May 20, 2010 at 09:34 AM
After saving my workbook it's not working anymore!
I only added column A to be cleared as well, can you have a look at my workbook?
https://authentification.site/files/22535057/Copy_of_PostPlanning.xls
The code is for sheet "Alle opdrachten"
Thanks in advance,
Trowa
May 20, 2010 at 09:39 AM
Looking at your solution, just a suggestion
Cells(processrow, "C").ClearContents
Cells(processrow, "E").ClearContents
Cells(processrow, "F").ClearContents
Cells(processrow, "G").ClearContents
can be consolidated into
Range(Cells(processrow, "C"), Cells(processrow, "G")).ClearContents
D is included in range but it will not matter as you have already disabled the events at the top.
I am also a bit confused over need for a do loop
Would not this be a shade better ?
May 20, 2010 at 09:49 AM
It works for me. though it is slow coz of do loop. It is processing rows that are not impacted by change. I think my solution would be a better fit here. You would need add A to my code as a separate line, as you dont want to clear B
May 21, 2010 at 08:58 AM
Don't you have to define the words "CELL" and "Target"? How does Excel know what to do with the lines "For Each CELL In Target" and "Next CELL"?
"Target" is a range according to the first codeline, but we didn't tell Excel what range, right?
Anyway, thanks for another great code.
Best regards,
Trowa