macro’s within excel. most functionality can be driven from vba vba is the programming language...
TRANSCRIPT
![Page 1: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/1.jpg)
Macro’sWithin excel
![Page 2: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/2.jpg)
Most functionality can be driven from VBAVBA is the programming language that runs inside of excel. It uses visual basic as the core as it stands for visual basic application.
![Page 3: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/3.jpg)
Printing with VBA
Sub CreatePrint() Dim answer As Integer answer = MsgBox("Are you sure you want to print sheet?", vbYesNo + vbQuestion, "Print Sheet") If answer = vbYes Then ActiveSheet.PrintOut Else 'do nothing End If End Sub
![Page 4: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/4.jpg)
Printing with VBA
Sub CreatePrint()
This part creates the sub-routine CreatePrint()
![Page 5: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/5.jpg)
Printing with VBA
Dim answer As Integer
We are now defining answer as an integer.
![Page 6: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/6.jpg)
Printing with VBA
answer = MsgBox("Are you sure you want to print sheet?", vbYesNo + vbQuestion, "Print Sheet")
We then are saying that the value of answer is equal to a response from a MsgBox (a pop-up dialog).
![Page 7: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/7.jpg)
Printing with VBA
If answer = vbYes Then
ActiveSheet.PrintOut
Else
'do nothing
End If
We now need to make sure the users meant to print and we can do so with their response and this if statement.
It checks to see if the dialog response was yes and if it was, it prints the sheet.
If it was no, it does nothing. The “’do nothing” is a comment, this is not actually processed it just helps us.
![Page 8: Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the](https://reader036.vdocuments.net/reader036/viewer/2022082613/5697bfce1a28abf838ca9a0a/html5/thumbnails/8.jpg)
Printing with VBA
End Sub
Then we end the subroutine so the computer does not get confused between all the Macro’s code.