Excel - Delete certain cells of active row


I would like a code for the following:

Check which row is active/selected and then delete the data which is in the 5th and 7th column of that row.

I've tried the following:

Sub test() 
r = ActiveCell.Row 
Range(r, 5).ClearContents 
Range(r, 7).ClearContents 
End Sub 

Can someone help me out with this?



cells(r,5) and cells(r,7)


Thanks to venka1926 for this tip on the forum.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Excel - Delete certain cells of active row », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).