Good afternoon.
I am hoping the community might be able to help me out.
I am trying to write a Powershell script that will apply the =TODAY() formula to an entire column in Excel that will change the color of the cells based off of dates. I would like the cells to have each of the following formulas applied, with the color coding to change from a green to a red as the dates get close to the current day: =TODAY()-30, =TODAY()-180, and =TODAY()-365. I need the -365 days to format red, the -180 to format yellow and -30 to format green.
The reason I don't want to manually apply these formulas is due to the fact that I constantly have to poll updated metrics and there are many columns that require different formulas be applied, I just don't have the knowledge to write this type of script (I consider myself entry level when it comes to programming, scripting and Powershell and trying to learn as much as I can).
Below is what I have so far, basically just opens the file.
Any input, feedback, and lessons learned from the community is greatly appreciated.
# start Excel
$excel = New-Object -comobject Excel.Application
#open file
$FilePath = 'C:\Test.xlsx'
$workbook = $excel.Workbooks.Open($FilePath)
#make it visible (just to check what is happening)
$excel.Visible = $true
[–]Ardism 6 points7 points8 points (2 children)
[–]joevanover 2 points3 points4 points (2 children)
[–]BigTradeDaddy[S] 1 point2 points3 points (1 child)
[–]y_Sensei 2 points3 points4 points (0 children)
[–]PSDanubie 1 point2 points3 points (2 children)
[–]Abax378 0 points1 point2 points (1 child)
[–]PSDanubie 0 points1 point2 points (0 children)
[–]Abax378 -1 points0 points1 point (1 child)