Project 2 - Create a report using PowerQuery, Macro VBA, List Functions and Data Validation functions for Data Reporting of Supply Chain Management companies
. CREATE A MACRO FOR CONDITIONAL FORMATING AND FREEZING PANNES
Public Sub conditionalformating()
Dim MYRANGE As Range
Set MYRANGE = Range("A1:DR307512")
MYRANGE.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween
Formula1 = "100": Formula2 = "150"
MYRANGE.FormatConditions(1).Interior.Color = RBG(0, 156, 0)
MYRANGE.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess
Formula1 = "100"
MYRANGE.FormatConditions(2).Interior.Color = VBVOILET
MYRANGE.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater
Formula1 = "150"
MYRANGE.FormatConditions(3).Interior.Color = vbGreen
MYRANGE.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess
Formula1 = "100"
MYRANGE.FormatConditions(2).Interior.Color = vborange
End Sub
. VBA code to convert selected data into pdf form
Sub convert_PDF()
Dim Rng As Range
Dim str As String
Dim myfile As Variant
If Selection.Count = 1 Then
Set Rng = Application.InputBox("select a range", "get range", Type:=8)
Else
Set Rng = Selection
End If
str = "Selection" & "_"
Format (Now)
str = ThisWorkbook.Path & "\" & str
myfile = appliction.GetSaveAsFilename
InitialFileName = str filefilter :="PDF Files (*.PDF), *.PDF", Title:="Select Folder and File Name to Save as PDF")
If myfile <> "False" Then
Rng.ExportAsFixedFormat Type:=xlTypePDF, Filename:=myfile, Quality:= xlQualityStandard, IncludeDocProperties;=True, IgnoreprintAreas:= False, openAfterpublish:= True
Else
MsgBox "No File Selected. PDF will mot be saved", vbOKOnly, "No File Selected"
End If
End Sub
. CHECK THE SPELLING MISTAKE IN THE WORKBOOK USING VBA CODE
sub spellcheck()
Dim cell As Range
For Each cell In ativesheet.UsedRange
If Not Application.CheckSpelling(word:=cell.Text) Then
cell.Style = "Bad"
End If
Next cell
End Sub