Search : in
By :

Delete certain cells of active row

Last answer on Sep 28, 2009 12:56:39 pm BST Trowa, on Sep 25, 2009 1:56:35 pm BST 
 Report this message to moderators

Hello,

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?

Best regards,
Trowa

Configuration: Windows 2003 Internet Explorer 7.0

Best answers for « Delete certain cells of active row » in :
Excel – Macro to detect and hide blank rows ShowExcel – Macro to detect and hide blank rows Issue Solution Note Issue I want a macro to unhide about 20 blank rows copy values into the top row then hide the remaining rows (some cells have fill though) then the next time it will...
[Excel]Clear the contents of specific cells. Show[Excel]Clear the contents of specific cells Issue Solution Notes Issue I have 6 cells with dropdowns list and they are selected each time. I wish I could have a reset button for the last entry for 6 cells(to clear them) but of...
[VBA] Deleting a word in a range of cell Show[VBA] Deleting a word in a range of cell In the case you want to delete a word in a sentence, just create a small macro that removes the word. But it will become difficult when you have word like, for example, "Theword" or "THEWORD" or...
Spreadsheets - Cell Selection ShowCell Selection Spreadsheets are powerful tools for working with data. However, to work with data, it is necessary to have tools to rapidly choose the required cells. Line Selection An entire line can be chosen by clicking directly on the line...
Worksheet - Cells ShowThe Concept of a Cell A "cell" is the intersection between a line (horizontal) and a column (vertical) on a worksheet. Thus, the name of the line combined with the name of the column gives the cell's coordinates (the term address is sometimes also...

1

venkat1926, on Sep 26, 2009 1:32:46 am BST
  • +1

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

Reply to venkat1926

2

 Trowa, on Sep 28, 2009 12:56:39 pm BST

Thanks Venkat, works like a charm.

Reply to Trowa