-
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... -
VBA樹林
[VBA] How to Position Excel Charts Pasted into PowerPoint at Arbitrary Locations
When pasting Excel charts into PowerPoint presentation materials, there are often scenarios where you want to freely control the placement of the graph using VBA. This article introduces how to use VBA to place a graph pasted into PowerP... -
VBA樹林
[VBA] How to Call Macros from Other Modules by Specifying the Module Name
Introduction In VBA, as the scale of a project grows, code is often managed by splitting it into different standard modules based on functionality. In such cases, there is a possibility of accidentally defining macros (procedures) with t... -
VBA樹林
[VBA] How to Determine the 3rd Character of a String
Introduction In this article, I will explain how to determine whether the 3rd character of a string is an alphabet letter or a number using VBA. Background I encountered a case where strings contained a mix of alphabets, numbers, and sym... -
VBA樹林
[Excel VBA] How to Change Scatter Plot Line Thickness Based on Cell Value
Background When visualizing data using multiple scatter plots in Excel, manually adjusting the line thickness for each chart individually can be tedious. It is often desirable to change the line thickness dynamically. This article introd... -
VBA樹林
[Excel VBA] How to Remove Line Breaks and Special Characters in Cells | Handling vbLf and ChrW
Overview In Excel, line breaks (created via Alt + Enter) or special characters contained within cells can cause visual discrepancies or processing errors. While manual removal is tedious, VBA allows for batch deletion. This article intro... -
VBA樹林
[VBA] How to Make UserForms Maximize, Minimize, and Resizable (Windows API)
Introduction By default, VBA UserForms have a fixed window size and only a "Close" button in the title bar. However, allowing users to freely change the size according to the amount of data displayed, or temporarily minimize the form to ... -
VBA樹林
Excel VBA: How to Dynamically Update the Data Range of an Existing Chart
Overview When creating reports in Excel, manually adjusting chart ranges every time the data volume increases or decreases is tedious. By utilizing the VBA SetSourceData method, you can update the specified cell range with a single click... -
VBA樹林
[VBA Beginner] How to Assign Values to Cells and Ranges | Basics and Usage of the .Value Property
In Excel VBA, you can directly input (assign) values to cells or cell ranges. Writing values to specific cells is a frequently used operation for initializing forms or as part of data processing. This article introduces how to assign val... -
VBA樹林
[VBA] How to Get Screen Resolution (Width and Height) (GetSystemMetrics API)
Introduction When creating UserForms in VBA, optimizing the display position and size based on the user's screen size is often necessary. For example, centering a form according to the screen resolution or adjusting a window so it does n... -
VBA樹林
[Excel VBA] How to Count File Opens | Auto-Tally with Macros
Introduction Have you ever wanted to know how often a shared Excel file is actually viewed? For example, it would be useful to know if "profile" or "guideline" files—which often exist just for the sake of formality—are actually being ope... -
VBA樹林
[Excel VBA] How to Batch Write 2D Array Values to a Cell Range for High Speed
There are many situations where large amounts of processing results calculated or processed in VBA macros need to be written to a worksheet. If you use a For loop to write values one cell at a time, the processing speed becomes extremely... -
VBA樹林
[VBA] How to Execute Code in Real-Time When a CheckBox State Changes
Introduction In VBA UserForms, there are frequent scenarios where specific processing needs to be executed the moment a checkbox is toggled on or off. A common example is interactive behavior, such as "enabling a text box for detailed in... -
VBA樹林
[VBA] How to Identify Error Types and Branch Processing (Err Object)
Introduction In VBA error handling, On Error GoTo jumps to a specific label regardless of the error, which can make it difficult to implement fine-grained responses based on the error type. On the other hand, On Error Resume Next simply ... -
VBA樹林
[Excel VBA] How to Compare Two Tables and Extract Unique Data Rows
Have you ever faced a situation where you need to compare a "Member List" and an "Event Attendee List" to find "Members who did not attend the event"? This task involves comparing two lists to find the "difference" data that exists only ... -
VBA樹林
[VBA] How to Bring an External App Window to the Front (SetForegroundWindow API)
Introduction When you launch other applications from a VBA macro using the Shell function or manipulate applications that are already open, the target window may sometimes be hidden behind other windows. In such cases, you can use the Wi... -
VBA樹林
[Excel VBA] How to Create a Folder If It Does Not Exist Using FSO (FolderExists)
When saving files to a specific folder or reading files from a folder using VBA macros, if the target folder does not exist, an error will occur, and the macro will stop. To prevent such errors, it is a golden rule to include a process t... -
VBA樹林
[VBA] How to Automatically Close a UserForm After Execution | Using Unload Me
Background When creating tools using UserForms in Excel, I was bothered by the fact that the form remained on the screen even after the program was executed. It looked cluttered, and I wanted to close the form to clearly indicate that th... -
VBA樹林
[VBA] How to Execute a Standard Module Macro from a UserForm Button
Introduction When creating an operation panel using a UserForm in VBA, you will inevitably encounter situations where you want to "execute a main process written in a standard module when a button on the form is clicked." For example, yo... -
VBA樹林
[Excel VBA] How to Extract XML Data Using XPath | Displaying Results in Excel
Introduction Since XML data has a hierarchical structure, using XPath (XML Path Language) is very effective for pinpointing and retrieving specific information. In Excel VBA, by using MSXML2.DOMDocument combined with XPath expressions, y... -
VBA樹林
[VBA Beginner] How to Get Working Days | Excluding Holidays and Weekends with NETWORKDAYS.INTL
In business, there are many situations where you need to know "how many business days later" something is, rather than just simple calendar days. For example, if you want to count the duration of a project excluding weekends and public h... -
VBA樹林
[VBA] How to Delete Rows with Past Dates in Word Tables | Automatically Clean Up Expired Rows
When managing schedules or logs in Word tables, you often need to delete rows containing dates that have already passed. This article introduces a VBA code snippet that automatically deletes rows with dates earlier than "today." Goal Tar... -
VBA樹林
[VBA] How to Get Command Prompt Execution Results (Output) as a String
Introduction While you can execute Command Prompt commands from VBA using the Shell function, there are times when you want to receive the execution result (text displayed on the screen) as a VBA variable to use within your program. Exam... -
VBA樹林
[VBA] How to Set UserForm Label Formatting (Text, Color, Size) via Code
Introduction In VBA UserForms, labels play a crucial role not just as static text, but as tool titles or status messages conveying processing results. While label formatting is typically set in the Properties window, changing it dynamica... -
VBA樹林
[VBA] How to Bulk Delete Rows Containing Blank Cells | Using SpecialCells and EntireRow
Introduction When processing data in Excel, you often encounter situations where you need to "delete rows that contain blank cells." Deleting them manually one by one is time-consuming, but combining VBA's SpecialCells and EntireRow allo...