Challenge

Project 2 - Create a report using PowerQuery, Macro VBA, List Functions and Data Validation functions for Data Reporting of Supply Chain Management companies

VBA code to convert Selected data into Pdf

Sub ExportToPDF()
Dim ws As Worksheet
Dim strFile As String
Dim strPath As String
Dim rng As Range
Set ws = ActiveSheet
Set rng = Application.Selection
strFile = InputBox("Enter a file name", "Save As")
If strFile = "" Then Exit Sub
strPath = Application.ActiveWorkbook.Path & "\" & strFile & ".pdf"
With ActiveSheet.PageSetup
.PrintArea = rng.Address
.Orientation = xlPortrait
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPath, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
ActiveSheet.PageSetup.PrintArea = ""
MsgBox "Data exported to PDF successfully!", vbInformation, "Export Complete"
End Sub

VBA code for Spelling Check

Sub CheckSpelling()
Dim rng As Range
Set rng = ActiveSheet.UsedRange

Application.DisplayAlerts = False
ActiveSheet.Parent.SpellingOptions.DictLang = xlEnglishUS

For Each cell In rng
If Not cell.HasFormula Then
cell.Activate
If Not Application.CheckSpelling(cell.Value) Then
cell.Interior.Color = RGB(255, 0, 0) 'highlight the cell in red if spelling is incorrect
End If
End If
Next cell

Application.DisplayAlerts = True
ActiveSheet.Parent.SpellingOptions.DictLang = xlNone

MsgBox "Spell checking complete!", vbInformation, "Spell Check"
End Sub

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.