ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change text color of specific date range by macro in Excel (https://www.excelbanter.com/excel-programming/369280-change-text-color-specific-date-range-macro-excel.html)

Morgan LeFay

Change text color of specific date range by macro in Excel
 
Hello,

in a worksheet (or preferably entire workbook) is it possible to run a
macro, for example, that looks for entries up to a specific date and changes
the text to a different color, after this does the same to other entries
using another color, etc. and how would such a macro look like?

Jeff

Change text color of specific date range by macro in Excel
 
Morgan,

I would use a do while loop that goes through your data looking for specific
dates.
I believe either of the items below will work for changing the text color
withing the cell

ActiveSheet.Cells(row, column).Select
Selection.Font.ColorIndex = 3
or
ActiveSheet.Cells(row,column).Font.ColorIndex = 3

This changes the background color of the cell

ActiveSheet.Cells(row, column).Interior.ColorIndex = 6

Hopefully, this will get you started.'

Jeff






ActiveSheet.Cells(row, 3).Interior.ColorIndex = 6



"Morgan LeFay" wrote:

Hello,

in a worksheet (or preferably entire workbook) is it possible to run a
macro, for example, that looks for entries up to a specific date and changes
the text to a different color, after this does the same to other entries
using another color, etc. and how would such a macro look like?



All times are GMT +1. The time now is 08:41 AM.

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