ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quick! Help With Code Formatting! (https://www.excelbanter.com/excel-programming/302327-quick-help-code-formatting.html)

alexm999[_83_]

Quick! Help With Code Formatting!
 
I have the following code:

Range("J9:O39").Select
Selection.Interior.ColorIndex = 35

When users say go to cell J9 and highlight the cell RED, then when
run my macro, i'd like it to skip the formatting that the user inputte
and just change the color for the remaining cells in the range...

Any ideas??

--
Message posted from http://www.ExcelForum.com


Marcotte A

Quick! Help With Code Formatting!
 
"alexm999 " wrote:

I have the following code:

Range("J9:O39").Select
Selection.Interior.ColorIndex = 35

When users say go to cell J9 and highlight the cell RED, then when I
run my macro, i'd like it to skip the formatting that the user inputted
and just change the color for the remaining cells in the range...

I'm assuming you want to change any cell that have not been changed already (rather than not changing only RED cells)

Sub test()
Dim Cell As Range
Range("J9:O39").Select
For Each Cell In Selection
If Cell.Interior.ColorIndex = xlNone Then Cell.Interior.ColorIndex = 35
Next Cell
End Sub


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com