Hello, I have a UserForm1 with a ListBox1. I need it to display the 2 columns from the Named Range "Test_Range" when the userfom is loaded. Thank you for your help.
Calculator.xlsm | ||||
---|---|---|---|---|
L | M | |||
22 | Current Year | 1/1/2024 | ||
23 | 60 Days from YE | 3/1/2024 | ||
24 | 90 Days from YE | 4/1/2024 | ||
25 | 120 Days from YE | 5/1/2024 | ||
26 | 150 Days from YE | 6/1/2024 | ||
27 | 180 Days from YE | 7/1/2024 | ||
Date Calculator |
Cell Formulas | ||
---|---|---|
Range | Formula | |
M22 | M22 | =DATE(YEAR(Abstract_Date),1,1) |
M23 | M23 | =DATE(YEAR(Current_Year),MONTH(Current_Year)+2,DAY(Current_Year)) |
M24 | M24 | =DATE(YEAR(Current_Year),MONTH(Current_Year)+3,DAY(Current_Year)) |
M25 | M25 | =DATE(YEAR(Current_Year),MONTH(Current_Year)+4,DAY(Current_Year)) |
M26 | M26 | =DATE(YEAR(Current_Year),MONTH(Current_Year)+5,DAY(Current_Year)) |
M27 | M27 | =DATE(YEAR(Current_Year),MONTH(Current_Year)+6,DAY(Current_Year)) |
Named Ranges | ||
---|---|---|
Name | Refers To | Cells |
Abstract_Date | =Dashboard!$B$2 | M22 |
Current_Year | ='Date Calculator'!$M$22 | M23:M27 |
VBA Code:
Private Sub UserForm_Initialize()
ListBox1.Clear
ListBox1.ColumnCount = 2
ListBox1.AddItem "Test_Range"
End Sub