条件格式? [英] conditional formatting?

查看:82
本文介绍了条件格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望当日期在到期后的30天内以及日期到期时再次使用列AF来更改颜色。

I am trying to get Column AF To Change Colors when the date is within 30 days of expiring and again when the date has expired.

推荐答案

你好nutosmrt,



 我想知道"日期"是否"在列AE,AF或其他。  

 我做了一个样本VBA:

 它比较了列"AE"和"AE"。有基准日期。

  
Hi nutosmrt,

  I'd like to know whether "the date" is in Column AE, AF, or other.  
  I've made a sample VBA:
  It compares Column "AE" with Base Date.
  
Private Sub CommandButton1_Click()
    Dim baseDate As Date
    baseDate = Range("AK3").Value
    ' ---
    Dim row As Integer
    Dim diffDay As Integer
    For row = 7 To 13
        diffDay = DateDiff("d", baseDate, Cells(row, 31).Value)
        Cells(row, 38).Value = diffDay
        ' ---
        If (diffDay > 30) Then
            Cells(row, 32).Interior.ColorIndex = 7  ' -- 7: Pink
        Else
            Cells(row, 32).Interior.ColorIndex = 4  ' -- 4: Green
        End If
    Next
End Sub




$
问候,

Ashidacchi



Regards,
Ashidacchi


这篇关于条件格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆