-
VBA樹林
[Excel VBA] How to Search for Values in a Table (ListObject)
This article introduces how to use Excel VBA to search for cells in a table that match specified conditions and retrieve their values. This procedure allows you to efficiently extract data that meets specific criteria from tables contain... -
VBA樹林
[Excel VBA] Two Ways to Decode URL-Encoded Strings
Japanese characters and symbols in URLs are converted into percent-encoding (e.g., %E3%81%AA). In Excel VBA, you can easily revert (decode) these strings to their original form using JScript or PowerShell. This article summarizes code ex... -
VBA樹林
[Excel VBA] How to Cancel Cut/Copy Mode [Usage of Application.CutCopyMode]
Introduction When automating tasks with Excel VBA, there are often situations where you want to implement a flow like "Copy a cell -> Paste it into another file -> Close the original file." I was trying to build exactly this proces... -
VBA樹林
[VBA] 3 Ways to Check if a Cell is Blank: Using IsEmpty, Len, and Comparison Operators
In Excel VBA, checking whether a cell is blank is a very common task. It is useful in various situations, such as "detecting missing entries" or "branching processing based on whether data exists." This article introduces three represent... -
VBA樹林
[Excel VBA] Differences Between the Three Methods to Save a Workbook (Save/SaveAs/SaveCopyAs) and How to Use Them
When you finish processing a workbook in VBA, the "Save" operation is always necessary at the end. However, VBA has three similar save methods: .Save, .SaveAs, and .SaveCopyAs. If you do not understand the differences correctly, it may l... -
VBA樹林
[VBA] How to Simulate Pressing “F2” and “Enter” Keys | Usage of SendKeys
Environment OS: Windows 10 Pro (Version: 20H2) Software: Microsoft Excel VBA Background While automating Excel tasks, I wanted to implement the operation of "entering cell edit mode (F2 key) and confirming (Enter key)" using VBA. I learn... -
VBA樹林
[Excel VBA] How to Correctly Read CSV Files by Specifying Character Encoding (UTF-8, etc.)
Have you ever experienced garbled text (Mojibake) when opening a CSV file in Excel? Especially when you directly open a CSV file saved in UTF-8 format in a Japanese environment Excel, full-width characters and symbols often get garbled. ... -
VBA樹林
[Excel VBA] How to Copy Only Visible Cells to Another Sheet After Filtering
Overview There are many situations where you want to transfer rows filtered by AutoFilter directly to another sheet. If you simply execute Copy, hidden rows are also copied. However, by combining this with SpecialCells(xlCellTypeVisible)... -
VBA樹林
[Excel VBA] Common Errors and How to Fix Them
Overview When developing programs using Excel VBA, you may encounter various errors. In this article, I will introduce errors I have actually experienced, along with their causes, explanations, and how to fix them. Runtime Error 1004: Me... -
VBA樹林
[Excel VBA] How to Unzip (Extract) Files to a Specified Folder
In VBA macros, you may often need to read and process data files (such as CSV or text files) contained inside ZIP archives received from external sources. In such cases, it is much smarter to automate the unzipping process using VBA rath... -
VBA樹林
[VBA] How to Create Macros Compatible with Both 32-bit and 64-bit Office (Vba7, Win64)
Since Excel 2010, Office has been available in both 32-bit and 64-bit versions. Consequently, VBA code—especially Declare statements that call Windows API functions—must be written differently depending on the bitness of the environment.... -
VBA樹林
[Excel VBA] How to Execute Macros with a Delay or Repeatedly (OnTime, GetTickCount)
Introduction In VBA, there are many situations where you want to implement time-based processing, such as "saving a file automatically after 5 minutes" or "updating sheet values every 10 seconds." Additionally, for more advanced usage, y... -
VBA樹林
[Excel VBA] Efficient Processing by Skipping Blank Cells! How to Implement “Do Nothing if Blank” Using If Statements
When processing multiple cells at once in Excel VBA, one common challenge is "how to handle blank cells." For example, have you ever encountered situations like these? You want to sum only cells where numbers are entered. You want to tra... -
VBA樹林
[VBA] How to Search for Cells and Manipulate Location Info: Basics of the Find Function
When automating data processing in Excel VBA, there are many situations where you want to search for a cell containing specific text and perform operations on it. In such cases, using the Find function allows you to efficiently locate th... -
VBA樹林
[VBA] How to Branch Processing Using Option Buttons in a UserForm
Introduction In this article, we will look at how to branch processing using option buttons placed on a UserForm. Environment: OS: Windows 10 Pro Version: 20H2 Background I wanted to place two option buttons on a UserForm, "Yes" and "No,... -
VBA樹林
[Excel VBA] No More Mojibake! How to Export CSV Files in UTF-8 (ADODB.Stream)
Have you ever experienced text displaying as "???" (garbled text) when uploading a CSV file created in Excel VBA to a web system or opening it on a PC with a different OS? This "Mojibake" occurs because the character encoding standardly ... -
VBA樹林
[Excel VBA] How to Get Sorted Results of Data or Arrays Using the SORT Function
There is often a need to obtain the sorted results of an Excel data range or a VBA array in memory without modifying the original data. By calling the SORT function (available in Excel for Microsoft 365 and Excel 2021 or later) from VBA,... -
VBA樹林
[Excel VBA] How to Fetch Web Data Without a Browser (MSXML2.XMLHTTP)
When you want to retrieve HTML or JSON from a website without launching a browser, you can use HTTP communication objects such as MSXML2.XMLHTTP. In this article, I will introduce the procedure to send a GET request to a sample URL (http... -
VBA樹林
[VBA Error Guide] Failed at ChartObject.Copy? Causes and Fixes for Error -2147221040 (800401d0)
When you try to copy a chart in VBA, you may suddenly encounter the error: "Run-time error -2147221040 (800401d0): Copy method of ChartObject class failed." This error can be confusing and difficult for VBA beginners to handle. In this a... -
VBA樹林
[Excel VBA] How to Branch Processing by Comparing Current Time (CDate & Time Function)
When building processes in VBA, you often need to create conditional branches based on time, such as "stop processing if the current time is past XX:00." I actually had a requirement to "prevent data writing after 5:00 PM," so I research... -
VBA樹林
[Excel VBA] How to Run a VBA Macro from Another Workbook (Application.Run)
As you proceed with VBA development, you will often face situations where you want to use the same logic across multiple files. Copying and pasting code every time is inefficient. Furthermore, if you need to make corrections, you have to... -
VBA樹林
[Excel VBA] How to Batch Update the X-Axis of Multiple Charts: Automate Manual Time Axis Adjustments
Overview Many people use multiple charts in Excel to visualize data and show changes over time. However, if the X-axis represents a "time axis," you often need to change the period or adjust the intervals. Doing this manually for every s... -
VBA樹林
[Excel VBA] How to Copy a Cell Range and Paste It as a Picture
Sometimes, you may want to paste a part of a table or report as a "snapshot" to another location. This ensures that the values and formatting remain fixed and do not change. By using the .CopyPicture method in VBA, you can copy a cell ra... -
VBA樹林
How to Launch the Default Browser and Display a Web Page in Excel VBA
Introduction This article explains the procedure to automatically launch the default browser from Excel VBA and open a specific web page. Using morinokabu.com as an example, we will introduce code and tips useful for improving business e... -
VBA樹林
[VBA] How to Get Selected Values from a ListBox (Multi-Column)
Introduction Getting data from a "selected row" after a user chooses an item in a UserForm ListBox is one of the most basic operations in VBA tool development. This is especially true for multi-column ListBoxes, where you often need to a... -
VBA樹林
[Excel VBA] How to Merge Cells with the Same Value in a Column
When organizing data in Excel, "Merge Cells" is useful for grouping consecutive cells with the same text to make them easier to read. In this article, I will explain how to automatically merge cells with the same value in a column using ... -
VBA樹林
[VBA] How to Manipulate Form Controls on a Sheet (ControlFormat Object)
Introduction Excel worksheets allow you to place two types of controls: "Form Controls" and "ActiveX Controls." Among these, Form Controls are generally easier to use. Usually, you link these controls to cells using the LinkedCell proper... -
VBA樹林
[Excel VBA] How to Detect Who Has a File Open (Preventing Shared File Conflicts)
Background When multiple people use an Excel file on a shared server, someone might start editing without knowing that another person already has the file open. This often leads to accidental overwrites or errors. For example, "Mr. Mori ... -
VBA樹林
[Excel VBA] 3 Properties to Get Workbook Full Path, Path, and Name
Introduction When using VBA macros to output a new file to the same folder as the current workbook or to log the location of an open file, you need to retrieve the workbook's "Full Path" (the complete path combining the file location and... -
VBA樹林
[Excel VBA] How to Suppress “Large Amount of Information on the Clipboard” Warning
Environment Edition: Windows 10 Pro Version: 20H2 Background When I tried to close a file using VBA, the following message appeared: "There is a large amount of information on the Clipboard. Do you want to be able to paste this informati...