-
Basic Excel VBA Msgbox
In this post I will show you how to make a basic vba msgbox. The msgbox basically is used to display a message to the user. Just add a button to your worksheet: Click the “Developer” tab Click the “Insert” button Add a button …then you can add this code to the button’s click event:…
-
VBA Listbox
This is a text and video example of how to implement a VBA Listbox: On your Excel worksheet show your “Forms Toolbar”. In Excel 2003 and prior, right click the standard toolbar (at the top of your screen) and choose “Forms Toolbar”. In Excel 2007 and above click the round Microsoft Office Button at the…
-
VBA Combobox
This is a text and video example of how to implement a VBA Combobox: On your Excel worksheet show your “Control Toolbar”. In Excel 2003 and prior, right click the standard toolbar (at the top of your screen) and choose “Control Toolbar”. In Excel 2007 and above click the round Microsoft Office Button at the…
-
VBA Concatenate
This is a text and video example of how to join strings together in VBA, (VBA Concatenate): ************************************************************************************* ‘IN THIS EXAMPLE I AM ATTACHING SOME TEXT AT ‘THE END OF A TEXT VARIABLE… Public Sub WriteAreaCode() Dim strText As String strText = Range(“A2”) strText = Left(strText, 3) Range(“B2″) = strText & ” area code” End…
-
VBA Trim
This is a text and video example of how to write a VBA Trim function: ************************************************************************************* Public Sub GetLastName() Dim strLastName As String strLastName = Range(“A2″) strLastName = Right(strLastName, 8) ‘THE TRIM FUNCTION CLEANS THE VBA STRING VARIABLE OF ‘ANY LINGERING SPACES BOTH BEFORE AND AFTER… ‘IT MAKES ” Jack” (WITH A SPACE IN THE…
-
VBA Mid
This is a text and video example of how to write a VBA Mid function: ******************************************************************** Public Sub GetMiddleName() Dim strMiddleName As String strMiddleName = Range(“A2”) strMiddleName = Mid(strMiddleName, 9, 3) Range(“C2”) = strMiddleName End Sub ‘THE SECOND ARGUMENT OF THE VBA MID FUNCTION ‘IS OPTIONAL ‘SO YOU DON’T HAVE TO USE IT IF YOU…
-
VBA Right
This is a text and video example of how to write a VBA Right function: ******************************************************************** Public Sub GetLastName() Dim strLastName As String strLastName = Range(“A2”) strLastName = Right(strLastName, 8) strLastName = Trim(strLastName) Range(“C2”) = strLastName End Sub ********************************************************************* Now watch how it’s done… Let me know if you have any questions [simple_contact_form]
-
VBA Left
This is a text and video example of how to write a VBA Left function: ******************************************************************** Public Sub GetFirstName() Dim strFirstName As String strFirstName = Range(“A2”) strFirstName = Left(strFirstName, 3) Range(“B2”) = strFirstName End Sub ********************************************************************* Now watch how it’s done… Let me know if you have any questions [simple_contact_form]
-
VBA Cells
This is a text and video example of how to maniputate VBA cells: ****************************************************************** Public Sub WriteToCells() ‘Both of these lines of code do the same thing. ‘In my opinion using the “Range” version is easier to remember… Worksheets(“Sheet1”).Range(“A1”) = “Name” Worksheets(“Sheet1”).Cells(1,1) = “Name” End Sub ******************************************************************* Now watch how it’s done… Let me know…
-
VBA Inputbox
This is a text and video example of a VBA Inputbox: The value provided to a VBA inputbox can be used in a message box or cell. This is a simple example of a VBA inputbox: *************************************************************** Public Sub InputBox() Dim strMsg As String Dim strInputBoxText As String strInputBoxText = Application.InputBox(“Enter Your Name”) Range(“D11”) =…