mori– Author –
-
VBA樹林
[VBA] Macro to Close Bento Orders in Excel | Auto-Lock by Date
Background In an Excel file used to manage bento (lunch) orders, there was a specific need: "Prevent inputs in the next day's order column after a certain time." Previously, this was done by manually locking the cells. To automate this, ... -
VBA樹林
[Excel VBA] How to Freely Change (Move) the Excel Window Position
Introduction There are times when you want to move the actual Excel window position during a VBA macro execution. For example, you might want to display Excel side-by-side with another application or present specific information in a pro... -
VBA樹林
[VBA] How to Master Class Property Definitions (Property Let/Get/Set)
Introduction When creating objects in VBA Class Modules, Properties serve as the gateway to safely manipulate the object's "data (attributes)" from the outside. Properly defining properties allows for advanced control, such as: Value Val... -
VBA樹林
[Excel VBA] How to Restrict/Release Scrollable Areas | Using ScrollArea
Introduction In Excel, there are times when you want to restrict the range of cells a user can interact with. For example, you might want to prevent accidental inputs or fix the layout of a form template. In such cases, the ScrollArea pr... -
VBA樹林
[Excel VBA for Beginners] How to Set Data Validation to Block Invalid Values | Using the Validation Property
Introduction Excel has a feature called "Data Validation" that restricts users to entering only specific formats or values. By controlling this feature via VBA, you can automate input checks and set up rules efficiently when initializing... -
VBA樹林
[Excel VBA] How to Freely Configure Headers and Footers for Printing
When printing forms or reports created in Excel, headers and footers are essential for including information such as "Document Title," "Date," "Page Number," and "Filename" on every page. Setting these manually can be time-consuming, but... -
VBA樹林
[Excel VBA] Change Cell Color to Yellow with “F9” and Red with “F10”
Background Previously, I created a tool where "pressing the F9 key runs code within a specific cell range." This time, I tried to expand functionality to support both the F9 and F10 keys. Specifications Target Range: Cells S1:S3. F9 Key:... -
VBA樹林
[Excel VBA] How to Automatically Record Save History | Log Who Saved When
When sharing Excel files, issues often arise where it is unclear "who saved the file and when" or "who is responsible for an entry error." To prevent such troubles, it is recommended to implement a system that automatically records the s... -
VBA樹林
[Excel VBA] How to Dynamically Switch Macros Assigned to Buttons or Shapes (OnAction)
Introduction Have you ever wanted to dynamically change the macro executed when clicking a button or shape on an Excel sheet based on the situation? For example, a toggle function where the same button acts as a "Start" button, but chang... -
VBA樹林
[VBA] How to Centralize Common Logic for Multiple Sheets in ThisWorkbook | Avoid Writing Code for Each Sheet
Background While creating VBA programs in Excel, I often found it inconvenient to write the same code repeatedly for multiple sheets. Duplicate code leads to poor maintainability. Every time specifications change, code in all sheets must... -
VBA樹林
[Excel VBA] How to Check Filter Status of a Sheet | Notify if Data is Filtered
Overview Determining whether an AutoFilter is set on a worksheet and whether filter criteria are currently applied allows for easier process branching and user alerts. In this article, I will explain a sample macro that checks the curren... -
VBA樹林
[Excel VBA] How to Disable the “Close” Button (X) in Excel (Windows API)
Introduction In VBA, there are times when you need extremely high-level control, such as "temporarily disabling the 'Close' button (X button) at the top right of the Excel window." This might be necessary when you want to force a specifi... -
VBA樹林
[Excel VBA] How to Open a Password-Protected Excel Workbook
When manipulating other workbooks with VBA, you may encounter files protected by a "Read Password." It is possible to open these workbooks automatically by letting VBA handle the password entry. In this article, I will explain the basic ... -
VBA樹林
[Excel VBA] How to Manipulate UserForm Controls by Name (String)
Introduction In VBA UserForms, when changing a label's text or a text box's value, we typically write the control's name directly, like Label1.Caption = "Text". However, this method doesn't work for dynamic processing where the control's... -
VBA樹林
[Excel VBA] How to Automatically Move to Cell A1 When Opening a File (Using ThisWorkbook)
Introduction "When you show an Excel file to someone, always make sure it opens at cell A1." Have you ever been given this rule by a supervisor? It is a common courtesy in business to ensure files look neat immediately upon opening. Howe... -
VBA樹林
[Excel VBA] How to Automatically Set Page Breaks at Fixed Intervals
Introduction When printing Excel sheets with large amounts of data, page breaks often occur in unintended places, cutting off tables mid-row and making them difficult to read. Manually setting page breaks one by one is extremely time-con... -
VBA樹林
[PowerPoint] How to Execute Macros from the Ribbon Using Custom UI Editor
Background When creating tools with PowerPoint VBA, placing buttons directly on slides can look unpolished. Adding a custom tab to the Ribbon (header area) provides a seamless, application-like experience. This article summarizes how to ... -
VBA樹林
[Excel VBA] How to Convert Numbers to Zero-Padded Strings (Left/Right Padding)
Overview In Excel, you often encounter situations where you need to align numbers to a fixed number of digits by adding zeros, such as converting "45" to "00045" or "45000". This is useful for various tasks like invoice numbers, IDs, cod... -
VBA樹林
[Excel VBA for Beginners] How to Get Cell Serial Values | Understanding the Difference Between Value and Value2
Introduction In Excel, dates and times appear in formats like "2025/7/20," but internally, they are managed as "Serial Values" (continuous numbers). Retrieving this "Serial Value" via VBA allows for accurate and efficient date comparison... -
VBA樹林
[Excel VBA] How to Manage Option Buttons with Group Boxes and Determine Selected Items
Introduction When using Option Buttons (Radio Buttons) on an Excel sheet for multiple questions—such as "Q1. Select a Plan" and "Q2. Select Payment Method"—you encounter a common problem: by default, all option buttons on a sheet belong ... -
VBA樹林
[Excel VBA] How to Paste a Cell Range as a “Linked Picture” That Automatically Updates
When creating dashboards or reports in Excel, you often have a sophisticated need: "I want to paste a table or chart from another sheet so it looks good, but I also want the pasted content to automatically update if the source data chang... -
VBA樹林
[Excel VBA] How to Jump to Another Cell and Return to the Original Cell (Application.GoTo)
When performing cell searches or navigation in VBA, you often encounter situations where you want to "move to another sheet or cell temporarily to do a task, and then return to the original location when finished." For example, you might... -
VBA樹林
[Excel VBA] How to Append Data to an Existing Text File (Append Mode)
When creating files in VBA, instead of overwriting the file as a new one every time, you often want to "continually add new data to an existing file." Typical examples include operation logs and data collection records. In this article, ... -
VBA樹林
[Excel VBA] How to Export a Sheet as a PDF File
When sharing Excel materials with others or saving them as official records, it is common to convert them to PDF format. This ensures the layout remains intact and allows anyone to open the file. While you can convert files to PDF manual... -
VBA樹林
[VBA] How to Randomly Select a Cell and Input a Value
Background While developing a tool in VBA, I encountered a situation where I needed to "randomly select one cell from a list and input a value into it." I realized this could be applied to creating seating charts or random assignment tas... -
VBA樹林
[Excel VBA] Mastering ListBoxes on Sheets! A Thorough Explanation of Major Properties
Introduction The "Form Control" ListBox, which can be placed directly on an Excel sheet, is a powerful tool for presenting options to users. To manipulate this ListBox freely with VBA, understanding its main properties is essential. In t... -
VBA樹林
[Word VBA] How to Automatically Insert Today’s Date on the Second Line | Right-Aligned “Update Date”
When creating documents in Word, do you ever find it tedious to manually type the date, such as "Update Date," every time? In this article, I will introduce a method using Word VBA to automatically insert today's date in the format "Upda... -
VBA樹林
[Excel VBA] How to Create and Control a New Window for the Same Workbook (NewWindow)
Excel's "New Window" feature is incredibly useful when you want to input data on one sheet while viewing summary results on another sheet in real-time. It allows you to display the same workbook in two windows simultaneously, showing dif... -
VBA樹林
[VBA] How to Use Class_Initialize (Constructor) to Set Default Values
Introduction When creating custom objects using VBA Class Modules, you often want to set default property values or run setup code the moment the object is created (instantiated). For example, when a "Product" object is created, you migh... -
VBA樹林
[Excel VBA] How to Set Formatting for Selected Shapes
In VBA, we typically manipulate shapes by specifying their names, like Shapes("Name"). However, there are many cases where you want to apply changes to "the shape I am currently selecting" without fixing the target in advance. Knowing ho...