Astra

VBA AND MACROS

Estimated reading: 1 minute

Excel VBA (Visual Basic for Applications) is a programming language used to create macros, automate repetitive tasks, and extend Excel’s functionality. Macros are sets of instructions that automate a sequence of Excel tasks such as data formatting, report generation, and calculation.

Excel’s built-in VBA editor can be used to create and edit VBA code. VBA allows you to create user-defined functions, automate tasks, interact with external data sources, and do a variety of other things.

Macros can be created by recording and saving a series of actions in Excel as a macro. You can also write the VBA code yourself using the VBA editor. Macros can be activated by clicking a button or by assigning a keyboard shortcut to them.

VBA MATH AND TRIGONOMITRIC FUNCTIONs

Excel VBA Abs Function (Get Absolute Value of a Range)
Excel VBA Abs Function (Get Absolute Value of a Range)

When you want to work with only non-negative numbers or remove the negative sign from numbers, Excel VBA offers you the Abs function. You can get the absolute value for a cell but not for a range with the Abs function. So, in this article, we will show you how to get the absolute value … VBA AND MACROS Read More »

How to Use VBA Atn Function in Excel (2 Examples)
How to Use VBA Atn Function in Excel (2 Examples)

The arctangent of a number, expressed in radians, is what the VBA’s Atn function computes. In a cartesian coordinate system, it is a trigonometric function that is used to determine the angle between a given point and the x-axis. In this article, we will show you 2 examples of how to use the VBA Atn … VBA AND MACROS Read More »

How to Use the Excel VBA Tan Function (2 Examples)
How to Use the Excel VBA Tan Function (2 Examples)

This article discusses the VBA Tan function. We will find the tangent values for the radian unit as well as for the degree unit. Purpose of the VBA Tan Function To calculate the tangent values for angles in radians. Syntax of the VBA Tan Function Arguments of the VBA Tan Function Arguments Explanation Number As … VBA AND MACROS Read More »

How to Use the Excel VBA Sin Function (2 Examples)
How to Use the Excel VBA Sin Function (2 Examples)

Similar to the general Excel SIN function, Excel VBA also has a dedicated function to get the Sine values for radian angles. So, you can directly apply the Sin function while writing a program with VBA. This article demonstrates how to get sine values for radians and degree angles with the Excel VBA Sin function. … VBA AND MACROS Read More »

Excel VBA ASin (ArcSine or Inverse Sine) Function (2 Examples)
Excel VBA ASin (ArcSine or Inverse Sine) Function (2 Examples)

While working with a trigonometrical function, you may need to know how to find the inverse value of Sine. In Excel’s basic feature, we have the ASIN function. But to apply this in VBA, a dedicated worksheet function is named the Asin function.  Purpose of the VBA ASin Function To find the angle in radians … VBA AND MACROS Read More »

VBA Cos Function
Excel VBA Cos Function for Radians and Degrees (3 Examples)

The Cos function returns the cosine of an angle, which is a ratio of the adjacent side of a right-angled triangle to the hypotenuse. Along with the basic Excel COS function, Excel has a dedicated Cos function in VBA.  Purpose of the VBA Cos Function The VBA Cos function returns the cosine values for a … VBA AND MACROS Read More »

Excel VBA Acos Function to Find Values in Degrees
Excel VBA Acos Function (ArcCos or Inverse Cos) (3 Examples)

The Acos function in Visual Basic for Applications (VBA) calculates the arccosine (inverse cosine) of a given angle in radians. The cosine of the angle is the only argument required for the Acos function, which then returns a value in radians between 0 and pi. Purpose of the VBA Acos Function To find the radian … VBA AND MACROS Read More »

Format Cell & Text Font in Excel VBA (Color, Size, Format, Name, Style)
Format Cell & Text Font in Excel VBA (Color, Size, Format, Name, Style)

In this article, you will learn how to format cells and text font using Excel VBA. Example 1: Format Text Font Color by Excel VBA You can use the three best-using properties to customize text color, these are vbColor, ColorIndex, and RGB values.  1.1 Use vbColors As an illustration, in cell B2, you want the … VBA AND MACROS Read More »

VBA Code to Convert PDF to  Excel
VBA Code to Convert PDF to Excel

This tutorial will teach us to convert PDF files to Excel files with simple VBA code. Note: Please check the references before running the code in Excel How the code works ? Here we will divide the total program into seven section Section A. Get the Path of the PDF Folder From a Cell of … VBA AND MACROS Read More »

VBA Prompt for File Location
VBA Prompt for File Location

In this tutorial, we will learn to prompt the user for the file or folder location using the VBA code. The following code will open the folder or file if the path is provided in the input box This code should open the specified file using the default program associated with the file type. If … VBA AND MACROS Read More »

VBA Get File Path from Filename
VBA Get File Path from Filename

Suppose you have a folder with thousands of files or subfolders. It’s a hassle to find any particular file location if you don’t know the exact file location. When you are unsure exactly where the file is located on your computer or do not want to copy the file name manually, you can use the … VBA AND MACROS Read More »

VBA Find Last Modified File in Folder
VBA Find Last Modified File in Folder

In this article, we will learn to find the last modified file in a folder by using the VBA code. Here we will consider two cases during the coding  Case1: Find Last Modified File in Folder(without sub-folder) Case2: Find Last Modified File in Folder(with sub-folder) Case 1: Find the Last Modified File in the Folder(without … VBA AND MACROS Read More »

Excel VBA File Properties
Excel VBA File Properties

In this tutorial, we will learn to show, save and modify the file properties by Excel VBA Example 1: Show the File Properties of the Current Workbook by VBA  The following code will show the file properties in a message box  Result: Properties of the current workbook will be shown in the message box as … VBA AND MACROS Read More »

Excel VBA Open File with Default Program
Excel VBA Open File with Default Program

The following Excel VBA code will open the file with the default program if the file path is provided.  Result: Run the code by pressing F5, and the file Solved Excel.jpg will be opened in the Photos app. What if the file path given is invalid or the default program wasn’t installed on the computer? … VBA AND MACROS Read More »

Excel VBA Run External Program
Excel VBA Run External Program

In this article, you will learn various methods to run an external program from excel by using VBA  Method 01: Run External Program by Using Shell Function You can run any external program using the shell function in Excel VBA.  The syntax of the shell function  Where PathName(string) is the path of the program to … VBA AND MACROS Read More »

VBA Code to Convert PDF to WORD File
VBA Code to Convert PDF to WORD File

The following code will convert all pdf files in a specified folder  to the Word file  Note: Please check the following references before running the code Result: The code will convert all files in the folder (C:\Users\USER\Downloads\SOLVED EXCEL) to Word file format(.docx)

Excel VBA Convert JPG to PDF
Excel VBA Convert JPG to PDF

When you need to convert files from one format to another, VBA can provide you with one spot solution, especially for converting files from one document format to another. However, in this article, we will learn how to convert Image files(.JPG format) to document format(.PDF format) Here we will divide the full program into four … VBA AND MACROS Read More »

Excel VBA Code to Read Text File Line by Line
Excel VBA Code to Read Text File Line by Line

In general, lines are separated by breaking one after another, which can be determined by the VBA built-in function vbCRLF. However, this article will teach us several ways to read a text file line by line using VBA.  Code 01: Read the Text File Line by Line using Line Input Statement Note: Check the following … VBA AND MACROS Read More »

Excel VBA Code to Read Text File Without Opening
Excel VBA Code to Read Text File Without Opening

The following VBA codes will read a text file from the given path without opening the text file. Method 01: Read the Text File using the Input method Without Opening the text file Note: Before running the code, please check the following references  Result: After running the code, the text file will be shown in … VBA AND MACROS Read More »

Excel VBA Code to Print (Save As) to PDF Multiple Pages
Excel VBA Code to Print (Save As) to PDF Multiple Pages

In this article, we will learn to print Excel sheets to PDF by Excel VBA. Here we will discuss the following examples. Example 01: Print All Sheets of the Current Workbook to Separate PDFs by VBA Using the following VBA code All the sheets of the current workbook will be saved in the same directory … VBA AND MACROS Read More »

How to Rename a Sheet Using Excel VBA (7 Examples)
How to Rename a Sheet Using Excel VBA (7 Examples)

It’s quite common to need to rename an Excel sheet. A sheet can be renamed effortlessly by double-clicking on the sheet name and typing the new name. However, if you need to accomplish a specific task, Excel VBA might be able to help. We will show you 7 different examples to rename sheet using Excel … VBA AND MACROS Read More »

Excel VBA: Delete Files in Folders and Subfolders
Excel VBA: Delete Files in Folders and Subfolders

In this tutorial, we will learn to delete files in folders and subfolders using Excel VBA. Here we will demonstrate several ways to delete files in folders and subfolders.  Code 01: Delete Files in Folders and Subfolders Using the Shell Command The user may select a specific folder and delete all of the files in … VBA AND MACROS Read More »

Excel VBA: Copy Data from Another Workbook Without Opening
Excel VBA: Copy Data from Another Workbook Without Opening

After reading this article, you will be familiar with the VBA codes to copy data from another workbook without opening it. Here, we will use multiple methods to copy data from another workbook. Code 01: Copy Data from Another Workbook Using Workbook Objects Following the VBA code enables a user to copy a specified range … VBA AND MACROS Read More »

3 thoughts on “VBA AND MACROS”

  1. I got what you mean , thankyou for posting.Woh I am happy to find this website through google. “Since the Exodus, freedom has always spoken with a Hebrew accent.” by Heinrich Heine.

  2. Hiya! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly? My website looks weird when browsing from my apple iphone. I’m trying to find a template or plugin that might be able to resolve this issue. If you have any recommendations, please share. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this Doc
Jump to Topics
SOLVED EXCEL
Scroll to Top