HowlingMadMurdock
New Member
- Joined
- Mar 9, 2016
- Messages
- 1
Hello,
I am working on a script for the company I work for. In short, I am running a report that shows how many days are left for each user (max is 100) and when the user is down to 10 days or less, they will receive an email warning them that they only have 10 days left. I am horrible when it comes to scripting and have limped my way through what I have now but it works. I will share what I completed so far, hopefully someone can help. Thank you
Sub delete_unused_information()
' Delete uneeded information
Range("A:A,C:C,D:D").Select
Selection.Delete Shift:=xlToLeft
'PURPOSE: Deletes single cells that are blank located inside a designated range
Dim rng As Range
Set rng = Range("A1:A300:B1:B300:C1:C300").SpecialCells(xlCellTypeBlanks)
rng.Rows.Delete Shift:=xlShiftUp
'Insert formula into each row.
Range("K2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.AutoFill Destination:=Range("K2:K250"), Type:=xlFillDefault
Range("K2:K250").Select
Dim strFormulas(1 To 3) As Variant
With ThisWorkbook.Sheets("download_18659668")
strFormulas(1) = "=SUM(B2+100)"
strFormulas(2) = "=MIN(C2-K2)"
.Range("C2").Formula = strFormulas(1)
.Range("C2:C245").FillDown
.Range("D2").Formula = strFormulas(2)
.Range("D2:D245").FillDown
End With
'Hide Column
Columns("K:K").Select
Selection.EntireColumn.Hidden = True
'Change column to number format
Columns("D:D").Select
Selection.NumberFormat = "0"
'Add cell description and autofit columns
Range("C1").Select
ActiveCell.FormulaR1C1 = "When 100 days ends"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Number of Days Left"
Columns("A:D").Select
Columns("A:D").EntireColumn.AutoFit
End Sub
I am working on a script for the company I work for. In short, I am running a report that shows how many days are left for each user (max is 100) and when the user is down to 10 days or less, they will receive an email warning them that they only have 10 days left. I am horrible when it comes to scripting and have limped my way through what I have now but it works. I will share what I completed so far, hopefully someone can help. Thank you
Sub delete_unused_information()
' Delete uneeded information
Range("A:A,C:C,D:D").Select
Selection.Delete Shift:=xlToLeft
'PURPOSE: Deletes single cells that are blank located inside a designated range
Dim rng As Range
Set rng = Range("A1:A300:B1:B300:C1:C300").SpecialCells(xlCellTypeBlanks)
rng.Rows.Delete Shift:=xlShiftUp
'Insert formula into each row.
Range("K2").Select
ActiveCell.FormulaR1C1 = "=TODAY()"
Selection.AutoFill Destination:=Range("K2:K250"), Type:=xlFillDefault
Range("K2:K250").Select
Dim strFormulas(1 To 3) As Variant
With ThisWorkbook.Sheets("download_18659668")
strFormulas(1) = "=SUM(B2+100)"
strFormulas(2) = "=MIN(C2-K2)"
.Range("C2").Formula = strFormulas(1)
.Range("C2:C245").FillDown
.Range("D2").Formula = strFormulas(2)
.Range("D2:D245").FillDown
End With
'Hide Column
Columns("K:K").Select
Selection.EntireColumn.Hidden = True
'Change column to number format
Columns("D:D").Select
Selection.NumberFormat = "0"
'Add cell description and autofit columns
Range("C1").Select
ActiveCell.FormulaR1C1 = "When 100 days ends"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Number of Days Left"
Columns("A:D").Select
Columns("A:D").EntireColumn.AutoFit
End Sub