Strike through when entering date

Solved/Closed
Bill - Dec 30, 2015 at 10:03 PM
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 - Jan 2, 2016 at 12:47 AM
Hello,
In excel I have a row of information in six different cells. The first cell and last cell have a date format. When I enter the last date to the far right I want the whole row to show a strike through each and every cell. I can still read it but it will show me the item is closed. Any help you can give me would be greatly appreciated.

Thanks
Bill

2 responses

vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
Jan 2, 2016 at 12:47 AM
Hello Bill,

A Guru I most certainly am not but I am glad that I could help.

Good luck with it all and Happy New Year!

Cheerio,
vcoolio.
8
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
Dec 31, 2015 at 04:12 AM
Hello Bill,

Perhaps the following code should do the task for you:-

Private Sub Worksheet_Change(ByVal Target As Range)

Application.ScreenUpdating = False
Application.EnableEvents = False

Dim lRow As Long
lRow = Range("A" & Rows.Count).End(xlUp).Row

For Each cell In Range("F2:F" & lRow)
     If cell.Value <> "" Then
     cell.EntireRow.Font.Strikethrough = True
     Else
     cell.EntireRow.Font.Strikethrough = False
     End If
 Next

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub


The code is a Worksheet_Change event which means it needs to be placed in the work sheet module. To do this, right click on the sheet tab, select "view code" and in the big white field that appears, paste the above code.

Go back to your work sheet. Each time that you enter a date in a cell in Column F, a strikethrough will appear across the row of data.

Please test the code in a copy of your work book first.

Following is a link to my test work book which shows you how it all works:-

https://www.dropbox.com/s/9o8t5bc5o1n2awy/Bill%28Strikethrough%2C%20worksheet_change%20event%29.xlsm?dl=0

I hope that this helps.

Cheerio,
vcoolio.
6
Hello Vcoolio,
You my friend are the Guru of program writing, Thank you so very much. I was racking my brain out trying to figure out how to solve this problem. I am so happy I found this site with CCM. Thanks again, you are the greatest.

Cheerio,
Bill
0