cgeorge4
Board Regular
- Joined
- Jul 24, 2011
- Messages
- 91
Hello,
I have exhausted myself trying to modify this code to run ONLY in the range the user selects. I have also tried to add an error handling section with a message box in case the user selects a range that does not contain any hard-coded cells.
1) Excel 2010 / PC Windows Premium 7
2) Code needed to delete a hard-coded number in any range selected by the user - BUT not making any changes to cells with formulas within the same range selected by the user.
3) An error handling section will be needed in case the user selects a range that doesn't have any hard-coded cells.
4) An error handling message box will be needed for #3. Message: "There are no hardcoded cells in the range you have selected. Please select a range".
5) The range selected by the user will normally be whole rows - but I would like the code to work for rows selected, or columns selected, or a range of cells selected.
IMPORTANT NOTE!!!: The rows selected can only be from row 37 and down. It will be an error by the user if they select rows 1 thru 36.
This code can not run on rows 1 thru 36. An error handling message will be needed in case the user tries to run this code
while rows 1 thru 36 (or any cells in those rows) are selected.
The code that I have modified works but not completely. It does delete the hard-coded cells in the range that I select - but if I have my cursor on one empty cell - it will remove hard-coded data from the WHOLE sheet.
I appreciate any assistance.
Here is my code:
Sub DELETE_Hardcode_In_Selected_Range()
With Selection
Selection.Cells.SpecialCells(xlCellTypeConstants, 1).ClearContents
End With
End Sub
Thank you so much,
Juicy,
I have exhausted myself trying to modify this code to run ONLY in the range the user selects. I have also tried to add an error handling section with a message box in case the user selects a range that does not contain any hard-coded cells.
1) Excel 2010 / PC Windows Premium 7
2) Code needed to delete a hard-coded number in any range selected by the user - BUT not making any changes to cells with formulas within the same range selected by the user.
3) An error handling section will be needed in case the user selects a range that doesn't have any hard-coded cells.
4) An error handling message box will be needed for #3. Message: "There are no hardcoded cells in the range you have selected. Please select a range".
5) The range selected by the user will normally be whole rows - but I would like the code to work for rows selected, or columns selected, or a range of cells selected.
IMPORTANT NOTE!!!: The rows selected can only be from row 37 and down. It will be an error by the user if they select rows 1 thru 36.
This code can not run on rows 1 thru 36. An error handling message will be needed in case the user tries to run this code
while rows 1 thru 36 (or any cells in those rows) are selected.
The code that I have modified works but not completely. It does delete the hard-coded cells in the range that I select - but if I have my cursor on one empty cell - it will remove hard-coded data from the WHOLE sheet.
I appreciate any assistance.
Here is my code:
Sub DELETE_Hardcode_In_Selected_Range()
With Selection
Selection.Cells.SpecialCells(xlCellTypeConstants, 1).ClearContents
End With
End Sub
Thank you so much,
Juicy,