Macro for deleting cell value in excel
Solved/Closed
Mouni369
Posts
4
Registration date
Monday 12 March 2012
Status
Member
Last seen
20 July 2012
-
12 Mar 2012 à 01:18
Masbrow - 11 Feb 2016 à 22:58
Masbrow - 11 Feb 2016 à 22:58
Related:
- Macro for deleting cell value in excel
- Excel mod apk for pc - Download - Spreadsheets
- Kernel for excel repair - Download - Backup and recovery
- Excel online macros - Guide
- Arrow keys not working in excel - Guide
- Delete duplicates in excel - Guide
3 responses
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
25 Mar 2012 à 07:51
25 Mar 2012 à 07:51
Create a common routine and call that routine
'rowToClearStarting : first row in the range that needs to be cleared
'rowToClearEnding : last row in the range that needs to be cleared
'Sample Call : clearContents(4,6)
Public Sub clearContents(rowToClearStarting As Long, rowToClearEnding As Long)
Sheets("sheet1").Range("d" & rowToClearStarting & ":d" & rowToClearEnding).clearContents
Sheets("sheet1").Range("e" & rowToClearStarting & ":e" & rowToClearEnding).clearContents
Sheets("sheet1").Range("g" & rowToClearStarting & ":g" & rowToClearEnding).clearContents
Sheets("sheet1").Range("h" & rowToClearStarting & ":h" & rowToClearEnding).clearContents
End Sub
Hi Rizvisa1,
Thanks for the reply.
Even this seems to be redundant... can't we specify the entire cells range and clear everything with single clearContents?
Just like range function which selects only one particular cell range, dont we have any other function.
Eg: A1:A5,B2:b8 both the ranges should be given in one particular function and we should be able to delete it .
Eg : sheets("sheet1").<function>("A1:A5","B2:B8").clearContents
Thanks,
Mouni873
Thanks for the reply.
Even this seems to be redundant... can't we specify the entire cells range and clear everything with single clearContents?
Just like range function which selects only one particular cell range, dont we have any other function.
Eg: A1:A5,B2:b8 both the ranges should be given in one particular function and we should be able to delete it .
Eg : sheets("sheet1").<function>("A1:A5","B2:B8").clearContents
Thanks,
Mouni873
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
25 Mar 2012 à 22:21
25 Mar 2012 à 22:21
Depends on what you want to do
One way would be
union(range("a1:c4"),range("b4:b6"),range("h4:h5")).clearcontents
One way would be
union(range("a1:c4"),range("b4:b6"),range("h4:h5")).clearcontents