-
VBA樹林
[VBA] How to Execute a Macro by Clicking a Command Button on a UserForm
Introduction UserForms are essential for providing graphical interfaces in VBA tools. The central element of these forms is the Command Button, which users click to trigger actions. You can easily link specific VBA macros to a simple cli... -
VBA樹林
[Excel VBA] How to Automatically Delete Columns Containing Only Dashes (‘-‘)
When organizing data in Excel, you may encounter columns that are completely filled with dashes ('-'). These columns are often unnecessary and clutter your spreadsheet. In this article, I will explain how to use VBA to automatically dele... -
VBA樹林
[Excel VBA] How to Convert a Cell Range to a Table (ListObject)
In Excel, converting tabular data into a Table (ListObject) allows you to utilize many features such as filtering, sorting, and structured references. This article explains how to use VBA to convert an existing cell range into a table an... -
VBA樹林
[VBA] How to Dynamically Add Controls to a UserForm and Handle Events
Introduction In VBA UserForms, developers typically place controls manually during the design phase. However, there are times when you want to determine the number or type of controls at runtime—for example, "automatically generating the... -
VBA樹林
[Excel VBA] Two Ways to Insert a SUM Total Below the Last Row of Data
In invoices or sales lists, it is very common to want to automatically calculate the total of a column and insert it immediately after the last data entry. Since the number of data rows changes every time, you need a macro that can dynam... -
VBA樹林
[Excel VBA] How to Extract Only Cells with Background Color
In Excel, background colors are often used to represent status or categories. However, manually extracting only the colored cells can be tedious and limited. This article introduces how to use VBA to search for "all cells with a backgrou... -
VBA樹林
[VBA] Organizing Code by Creating Subroutines (Modularization)
Introduction When creating macros in VBA, you might find yourself writing procedures that become dozens or even hundreds of lines long. This often leads to "spaghetti code," where it is difficult to understand what is happening and where... -
VBA樹林
[VBA] How to Auto-Resize Excel Charts Pasted in PowerPoint (Adjust by cm)
It is common to want to precisely adjust the size of an Excel chart after pasting it into PowerPoint using VBA. In this article, I will share the VBA code to paste a chart as a "picture" and then automatically resize it to specific dimen... -
VBA樹林
[Excel VBA] How to Import Access Tables: A Simple Guide for Beginners
I will introduce how to easily read table data saved in an Access database (.accdb format) using Excel VBA. This article explains how to use DAO (Data Access Objects) to retrieve Access information using only VBA code. The VBA Code Below... -
VBA樹林
[Excel VBA] How to Read Specific Lines from a Text File (EUC-JP Support)
There are many cases where you need to extract only specific lines from large log files or text data. If a file is too large, reading the entire content can negatively affect performance. In such cases, reading only the necessary part by... -
VBA樹林
[VBA] How to Call a Standard Module Macro from a UserForm Button
Introduction When creating professional tools in VBA, you often use UserForms to build interactive interfaces. A common requirement is: "When I click a button on the form, I want to run the main processing logic written in a Standard Mod... -
VBA樹林
[VBA] How to Paste Excel Charts to PowerPoint as Images (Using PasteSpecial)
When using Excel VBA to paste charts into PowerPoint, have you ever wanted to paste them as a static "picture (image)" rather than an editable chart? In this article, I will explain how to paste an Excel chart as a "Shape (PNG Image)" on... -
VBA樹林
[VBA] How to Batch Rename Files Based on an Excel List (Using FSO)
Introduction "I have a list of product codes and names, but the actual image files are named with just codes..." or "I want to rename files in bulk to match a list managed in Excel." The need to batch rename a large number of files using... -
VBA樹林
[VBA] Automate CSV Imports to Excel: No More Copy-Pasting
Background I used to manually copy and paste the contents of CSV files into Excel. This process was repetitive and time-consuming, so I created a VBA macro to import CSV files directly. This is particularly efficient when handling databa... -
VBA樹林
[Excel VBA] How to Perform Modern Lookups with the XLOOKUP Function
For many years, the VLOOKUP function was the standard for lookups in Excel, but it had several weaknesses. For example, the search column had to be on the far left, and it returned errors when values were not found. In Excel for Microsof... -
VBA樹林
[PowerPoint/VBA] Automatically Insert .bmp Images into Slides
Background I am writing a VBA program for PowerPoint. Previously, I was manually cropping and pasting .bmp images repeatedly using image editing software. I decided to automate this process to save time. Specifications When you run the p... -
VBA樹林
[Excel VBA] How to Compress Multiple Files into a ZIP Archive (Shell.Application)
It is common to want to combine multiple report files generated by macros into a single ZIP file for email attachments or backups. Although VBA does not have a direct command to manipulate ZIP files, you can compress files by controlling... -
VBA樹林
[Excel VBA] How to Set Cell Formatting (Applying Thousands Separators Automatically)
Overview In Excel, changing the "Display Format" (formatting) is often necessary to improve the appearance of numbers. In particular, the thousands separator (comma every 3 digits) is essential for readability when dealing with amounts o... -
VBA樹林
[Excel VBA] How to Get File Properties (Name, Extension, Date, Size) Using FSO
When handling files or file lists in VBA, you often need detailed information (metadata) such as the file extension, size, and last modified date, rather than just the file name. By using the FileSystemObject (FSO), you can retrieve this... -
VBA樹林
[VBA] How to Launch External Applications Using the Shell Function
When working with VBA macros, you may often need to launch external applications outside of Excel, such as opening Notepad to write logs or opening a browser to access a specific URL. The VBA Shell function makes it easy to execute such ... -
VBA樹林
[Excel VBA] How to Automatically Register Power Query Connections
Adding Power Query via VBA allows you to reload CSV or text files with a single click, simplifying daily data updates. This article explains how to use the WorkbookQuery object to register a CSV data connection, along with sample code an... -
VBA樹林
[Excel VBA] How to Turn AutoSave On/Off Using VBA (.AutoSaveOn)
In Microsoft 365 Excel, "AutoSave" is enabled by default for files saved to OneDrive or SharePoint. While this feature is very convenient for collaborative editing and preventing data loss, it can cause issues when processing large amoun... -
VBA樹林
[VBA] How to Locate and Delete the Personal Macro Workbook (PERSONAL.XLSB)
Introduction As you start using VBA, you will likely hear about the "Personal Macro Workbook." This is a very convenient hidden workbook that allows you to save macros for use in any open Excel file. However, situations may arise where y... -
VBA樹林
[VBA] Running a Macro Automatically When Selecting a Cell (Triggering on Column G)
Overview Have you ever wanted to automatically execute a macro just by selecting a specific cell in Excel? This article introduces how to create a VBA macro that runs a program automatically when you place the cursor on cells G2 to G100.... -
VBA樹林
[Excel VBA] How to Delete Worksheets Without Confirmation Prompts
In VBA macros, it is common to delete temporary sheets or old data at the end of a process. However, simply using the .Delete method triggers a standard Excel confirmation message: "Data may exist in the sheet(s) selected for deletion. T... -
VBA樹林
How to Add and Delete Table Slicers in Excel VBA | Automating Dynamic Filtering UIs
Slicers are a convenient feature that allows you to visually filter Excel tables and PivotTables. By using VBA, you can automatically add, delete, and rearrange slicers. This article explains the steps to set up and remove slicers using ... -
VBA樹林
[Excel VBA] How to Split Cell Data by Comma into Columns Using TextToColumns and FieldInfo
When analyzing or processing data, you often encounter cases where multiple items are combined in a single cell, separated by a delimiter. This is especially common when pasting CSV data, resulting in a structure like "Name,Date,Address.... -
VBA樹林
Automating Microsoft Edge Form Input and Submission with Excel VBA and SeleniumBasic
Overview This article explains how to control Microsoft Edge from Excel VBA to input keywords into a web search form and submit it. In this example, we will use the site https://morinokabu.com/ to demonstrate the process of retrieving fo... -
VBA樹林
How to Get a Unique List Using the UNIQUE Function in Excel VBA
In Excel 365 and later, you can easily create a list without duplicates (a unique list) using the UNIQUE function. This feature is available not only on the worksheet but also from VBA. You can get the results directly as an array and us... -
VBA樹林
[Excel VBA] Mastering ComboBoxes (DropDowns) on Sheets! Major Properties Explained
Introduction The "Form Control" ComboBox (known as the DropDown object in VBA) that can be placed on Excel sheets is a convenient tool for presenting options to users while saving space. To manipulate this ComboBox freely with VBA, under...