VBA Code to Delete File
EXCEL VBA TRICKS

VBA Code to Delete File

In this article we are going to show you how you can delete file or files using a single line of VBA code. 1. Delete a specific file from the folder, 2. Delete specific type of files from the folder, 3. Delete all files from the folder

Read More
VBA Code to Add Border to Excel Range
EXCEL VBA TRICKS

VBA Code to Add Border to Excel Range

Through formatting the cells, you can make your Excel data more beautiful and easier to understand. If you record a macro to add borders to Excel range, you will notice that it generates 30 plus lines of code for just a small work. Here we are sharing one line of code which does the same thing.

Read More
Protect Excel Sheet for Manual Input
EXCEL VBA TRICKS

VBA Code to Protect Excel Sheet for Manual Input but Allow Programming Inputs

Did you come across any requirement where you want the user to interact with a sheet only through VBA Form? Here is a simple code which can help you.

Read More
VBA Code to Add Items in ListBox Control in Userform
EXCEL VBA TRICKS

VBA Code to Add Items in ListBox Control in Userform

Using ListBox in Userform is very common. You can use ListBox.AddItem function to add items in the listbox.; however, it is little difficult to add items in Listbox when the number of columns are more than one. Here is a sample VBA code to help you ‘Event handler to add …

Read More
VBA Code to Find Duplicate Files
EXCEL VBA TRICKS

VBA Code to Find Duplicate Files

Yesterday I was working on my computer and cleaning the drives to make some more space.  I was surprised to see so many files saved at multiple places which was consuming huge space of my computer drives. One of the biggest tasks was to identify such duplicate files. Initially I …

Read More
VBA Code to Find Last Column or Row of a Sheet
EXCEL VBA TRICKS

VBA Code to Find Last Column or Row of a Sheet

Sometimes as a developer, you need to take actions in Excel sheets based on last row or column. In Excel, there are two kinds of last cells available: The last cell of the sheet which is XFD1048576 for Excel 2007 or above and IV65536 for Excel 2003 The last used …

Read More
VBA Code to Read Excel Data using Connection String
EXCEL VBA TRICKS

VBA to Read Excel Data using Connection String

Sometimes as a programmer you need to read heavy (more then 5 MB) Excel files. There are two ways you can read data from Excel files: Open the file using VBA and read the data. Click Here Stablish ADODB connection with Excel file and read data using SQL queries Here …

Read More
VBA To Rename Files
EXCEL VBA TRICKS
2

Excel VBA Tool to Rename Files

Here is another help code and tool for programmers to rename files. You can use this tool for renaming all files available in a selected folder. Just browse the folder and hit ‘Rename Files’ button ‘This function loops through all the files listed in the sheet and ‘rename them as …

Read More
EXCEL VBA TRICKS

VBA Code to Change Sheet Tab Color

Here is another help code for programmers to change the color of Excel sheet tab. I have shown two ways to achieve this: Using standard colors like Green, Blue, Red, White etc. Using RGB (Red, Green Blue) function to set a specific color ‘This function changes the tab color of …

Read More
EXCEL VBA TRICKS

VBA Code to Sort Data

Here is a one line code for developer’s reference which can be used to sort data ‘Sort data in ascending order on Column F (Created At) Sheet1.Range(“A1:G” & Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row).Sort Key1:=Sheet1.Range(“F1”), Order1:=xlAscending, Header:=xlYes, DataOption1:=xlSortNormal Before Sort: After Sort:     If you are looking for a VBA code that can sort …

Read More
EXCEL VBA TRICKS

VBA Code to Filter Data in Excel

Here is an easy reference code which filters data in the sheet. In the code, we have filtered the data in three steps. Step 1: Remove existing filter from the sheet (if any). This code ensures if there is already a filter applied then the same is removed first Step …

Read More