Project 2 - Create a report using PowerQuery, Macro VBA, List Functions and Data Validation functions for Data Reporting of Supply Chain Management companies
Note : https://docs.google.com/spreadsheets/d/148Ru3OYKI-7lHbxBDFVWZIdHiMuwEq0z/edit?usp=share_link&ouid=117985351486626761902&rtpof=true&sd=true
Note : My sort function is not working in my excel version. I Used The SUMIF Function.
=UNIQUE(array, [by_col], [exactly_once])
=FILTER(array, include, [if_empty])
=SORT(array, [sort_index], [sort_order], [by_col])
1.
Sub MultipleConditionalFormattingExample()
Dim MyRange As Range
'Create range object
Set MyRange = Range("A1:A10")
'Delete previous conditional formats
MyRange.FormatConditions.Delete
'Add first rule
MyRange.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="=100", Formula2:="=150"
MyRange.FormatConditions(1).Interior.Color = RGB(255, 0, 0)
'Add second rule
MyRange.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="=100"
MyRange.FormatConditions(2).Interior.Color = vbBlue
'Add third rule
MyRange.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, _
Formula1:="=150"
MyRange.FormatConditions(3).Interior.Color = vbYellow
End Sub
2.
Public Sub FreezePanes()
With ActiveWindow
If .FreezePanes Then .FreezePanes = False
.SplitColumn = 0
.SplitRow = 1
.FreezePanes = True
End With
End Sub
3.
Sub PrintSelectionToPDF()
'SUBROUTINE: PrintSelectionToPDF
'DEVELOPER: Ryan Wells
'DESCRIPTION: Print your currently selected range to a PDF
Dim ThisRng As Range
Dim strfile As String
Dim myfile As Variant
If Selection.Count = 1 Then
Set ThisRng = Application.InputBox("Select a range", "Get Range", Type:=8)
Else
Set ThisRng = Selection
End If
'Prompt for save location
strfile = "Selection" & "_" _
& Format(Now(), "yyyymmdd_hhmmss") _
& ".pdf"
strfile = ThisWorkbook.Path & "\" & strfile
myfile = Application.GetSaveAsFilename _
(InitialFileName:=strfile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and File Name to Save as PDF")
If myfile <> "False" Then 'save as PDF
ThisRng.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
myfile, Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
Else
MsgBox "No File Selected. PDF will not be saved", vbOKOnly, "No File Selected"
End If
End Sub
4.
Sub HighlightMisspellings() Dim cell As range For Each cell In ActiveSheet.UsedRange 'Check the spelling and if it's wrong, then change the style to be Bad If Not Application.CheckSpelling(word:=cell.Text) Then cell.Style = "Bad" End If Next cell End Sub