Populating a listbox with text from worksheet

theduckman16

New Member
Joined
Feb 4, 2011
Messages
16
Hello,

I am fairly new to VBA and am trying to do a complex macro (I think). I have not been able to find a solution online.

Here is what my goal is:

I have 10 sheets in my worksheet that all have seperate calendar dates starting on cell O1 and ranging to AE1. I would like to create a macro that takes the dates from these cells and puts them into a form that a user can select; based off of the columns of data they would like to keep. I would like the macro to delete the columns that were not selected.

Any help would be appreciated.

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I have found the following code that will put the text in each row into a listbox, but I can't figure out how to get the text from the columns.

Code:
Private Sub UserForm_Initialize()
With Sheets("Sheet1")
     Me.ListBox1.List = _
          .Range("a3", .Range("a" & Rows.Count).End(xlUp)).Resize(, 7).Value
End With
With Me.ListBox1
     .ColumnCount = 1
     .MultiSelect = 0
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,047
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top