-
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... -
VBA樹林
[VBA] Two Ways to Close a UserForm: The Difference Between Unload and Hide
Introduction When closing a UserForm in VBA, there are two similar methods: the Unload statement and the .Hide method. While both result in the form disappearing from the screen, there is a distinct difference in how they handle memory a... -
VBA樹林
[Excel VBA] How to Batch Delete Rows Hidden by AutoFilter
When organizing data, a common scenario involves extracting only necessary data using Excel's AutoFilter function and then deleting all other rows that were hidden by the filter. Performing this manually is difficult, but VBA can automat... -
VBA樹林
[VBA x Word x Outlook] Macro to Auto-Create Email with File Attachment | Auto-Fill Recipients & Body
Sending documents created in Word to the same recipients via email is a standard task. Automating this repetitive work with VBA significantly reduces operation time. This article introduces a method to create a macro that, when executed ... -
VBA樹林
[Excel VBA] The Basics of Speeding Up Macros: Application.ScreenUpdating = False
Introduction When executing VBA macros, especially loop processes that manipulate many cells, you may have experienced slow performance or a flickering screen. The cause is that Excel dutifully redraws the screen for every single operati... -
VBA樹林
[Excel VBA] How to Automatically Color Cells Containing Specific Strings | Utilizing ReplaceFormat
When highlighting cells containing specific keywords in Excel, using Filters or Conditional Formatting is common. However, using VBA allows for the automation of batch coloring processes. This article introduces a concise and powerful VB... -
VBA樹林
[Excel VBA] How to Compare Two Tables and Extract Common Data Rows
In data analysis, comparing two lists—such as "Last Month's Customer List" and "This Month's Customer List"—to extract only the customers present in both is a frequent task. This is the process of finding the "intersection" of two datase...