ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can you load part of a worksheet into a userform (https://www.excelbanter.com/excel-programming/358348-re-can-you-load-part-worksheet-into-userform.html)

Tom Ogilvy

Can you load part of a worksheet into a userform
 
Maybe something like this:

Private Sub Userform_Initialize()
Dim rng as Range
With worksheets("Data")
set rng = .Range(.Cells(2,"B"),.Cells(rows.count,"B").end(xl up))
End with
with me.ListBox1
.ListCount = 2
for each cell in rng
.AddItem cell.Vaue
.List(.listcount-1,1) = cell.offset(0,3).Value
Next
End With
End Sub

--
Regards,
Tom Ogilvy

"wAyne" wrote:

I have 2 columns on a worksheet which include a list of default values. What
I want to do is allow people to add to the list - but I would like to do this
in a user form for 2 reasons 1 - almost everything else they do is through
user forms and 2 I want them to see only the columns that contain the
information they need. Columns B and E.

I could do this by protecting the shet and hiding all other columns - but
would like to make it neater, by displaying the range of cells, or both
columns on a user form.

Is this possible?
wAyne_



All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com