LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Rowsource Question

I originally posted this question on 11/14, but I still haven't been able to
figure out how to solve the problem based on the response that I got. So I
am posting the question again in more detail.

If Noah is the user, I want the RowSource of ListBox1 in UserForm1 to fill
with values from Sheet1. If Joe is the user, I want the RowSource of
ListBox1 in UserForm1 to fill with values from Sheet2. I am not sure if this
is the right think to do, but I have left the RowSource field in the
Properties of ListBox1 empty.
-----------------------
I currently have the following code in Module1:
Public rng as Range

Sub Macro1()
Dim User As String
User = Environ("UserName")
Select Case User
Case "Noah"
lastrow = Sheet1.Cells(1, 1).End(xlDown).Row
rng = Sheet1.Range(Cells(1, 1), Cells(lastrow, 2))
UserForm1.Show
Case Joe
lastrow = Sheet2.Cells(1, 1).End(xlDown).Row
rng = Sheet2.Range(Cells(1, 1), Cells(lastrow, 2))
UserForm1.Show
Case Else
End Select
End Sub
-----------------------
I currently have the following code in the code module for UserForm1:

Private Sub UserForm_Initialize()
Me.ListBox1.RowSource = rng.Address
End Sub
------------------------

The error message that I keep getting is: "Could not set the RowSource
property. Invalid property value." Please help! Thanks!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm ComboBox RowSource Question Minitman[_4_] Excel Programming 0 November 15th 05 07:03 PM
TextBox RowSource Question Minitman[_4_] Excel Programming 12 February 16th 05 06:28 AM
help with rowsource GMet Excel Programming 4 September 24th 04 02:30 PM
combobox rowsource Newbie Excel Programming 1 September 8th 04 12:21 PM
Using IF, Then with rowsource? CAA[_23_] Excel Programming 8 April 4th 04 08:56 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"