本文介绍了突出显示我没有任何目标的日期。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有电子表格 Col B =交易日期Col B= Date of trade Col M =我的每日目标被击中的时间。Col M = time when my daily target got hit.我想突出显示当我击中目标时的日期范围以及我没有击中目标的日期。在下面的屏幕截图中,蓝色框显示了col B中的单元格范围,其中我的日期是11/27/2015,我已经在第42行和第M行中击中目标。所以我想要突出显示所有日期11/27/2015I want to highlight the range of dates when I hit a target and dates that I did not hit a target. in the screenshot below, the blue box shows the range of cells in col B where I have the date 11/27/2015 that I have hit the target in row 42 and col M. so I want to highlight all the dates 11/27/2015如果你看看2015年11月29日在col B的黄色方块,我没有col M.中的任何值。所以我想保持原样。我怎么能在excel中做到这一点?if you look at yellow box with date 11/29/2015 in col B, I don't have any values in col M. so I want to leave it as is. how can I do it in excel?指向excel文件的链接 文件上传存储空间link to the excel filefile upload storage推荐答案 我已经制作了样本VBA。 复制并粘贴"Sheet3"代码。 (打开时预订,选择"Sheet3"以外的工作表,然后选择"Sheet3"。)Hi,I've made a sample VBA.Copy and paste in code of "Sheet3".(when open the Book, select a sheet other than "Sheet3", and then select "Sheet3".)Private tradeDate As StringPrivate lastRow As LongPrivate myRow As Long' --- get last row when this sheet activatePrivate Sub Worksheet_Activate() lastRow = Range("A1048576").End(xlUp).RowEnd SubPrivate Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Target, Range("M2:M1048576")) Is Nothing Then Exit Sub Else ' --- active cell has been changed in column M If (ActiveCell.Value = "") Then Exit Sub Else tradeDate _ = Year(ActiveCell.Value) & "/" _ & Month(ActiveCell.Value) & "/" _ & Day(ActiveCell.Value) Call prc_HighLight_Date End If End IfEnd Sub' --- HighLighting: selected Cell (column M) and tradeDate (column B)Private Sub prc_HighLight_Date() Application.ScreenUpdating = False Range("B2:B1048576").Interior.ColorIndex = 2 Range("M2:M1048576").Interior.ColorIndex = 2 ' --- ActiveCell.Interior.ColorIndex = 6 ' -- 6: Yellow ' --- For myRow = 2 To lastRow If (Cells(myRow, 2).Value = tradeDate) Then Cells(myRow, 2).Interior.ColorIndex = 6 ' -- 6: Yellow End If NextEnd Sub 问候, AshidacchiRegards,Ashidacchi 这篇关于突出显示我没有任何目标的日期。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-02 17:11