Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Intialization
Why does the code below not set OptionButton1.Value to True?
Private Sub UserForm_Initialize() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox1.Text = rng(1, 1).Text TextBox2.Text = rng(1, 2).Text TextBox3.Text = rng(1, 4).Text If rng(1, 3) = "member" Then OptionButton1.Value = True End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Intialization
the obvious answer is that rng(1,3) = "member"
even though you might think it does. (extra space?, activecell not what you think it is? ) -- Regards, Tom Ogilvy "Patrick Simonds" wrote: Why does the code below not set OptionButton1.Value to True? Private Sub UserForm_Initialize() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox1.Text = rng(1, 1).Text TextBox2.Text = rng(1, 2).Text TextBox3.Text = rng(1, 4).Text If rng(1, 3) = "member" Then OptionButton1.Value = True End If End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Intialization
Turns out it case case sensative. The rng(1, 3) contained the word Member
not member "Tom Ogilvy" wrote in message ... the obvious answer is that rng(1,3) = "member" even though you might think it does. (extra space?, activecell not what you think it is? ) -- Regards, Tom Ogilvy "Patrick Simonds" wrote: Why does the code below not set OptionButton1.Value to True? Private Sub UserForm_Initialize() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox1.Text = rng(1, 1).Text TextBox2.Text = rng(1, 2).Text TextBox3.Text = rng(1, 4).Text If rng(1, 3) = "member" Then OptionButton1.Value = True End If End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Intialization
There you go! <g
Yes, equality of strings is case sensitive unless you change with declare Option Compare Text at the top of the module better probably is you can make it case insensitive with if lcase(rng(1,3)) = "member" then -- Regards, Tom Ogilvy "Patrick Simonds" wrote in message ... Turns out it case case sensative. The rng(1, 3) contained the word Member not member "Tom Ogilvy" wrote in message ... the obvious answer is that rng(1,3) = "member" even though you might think it does. (extra space?, activecell not what you think it is? ) -- Regards, Tom Ogilvy "Patrick Simonds" wrote: Why does the code below not set OptionButton1.Value to True? Private Sub UserForm_Initialize() Dim rng Set rng = Cells(ActiveCell.Row, 1) TextBox1.Text = rng(1, 1).Text TextBox2.Text = rng(1, 2).Text TextBox3.Text = rng(1, 4).Text If rng(1, 3) = "member" Then OptionButton1.Value = True End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform to enter values and shown in same userform in list | Excel Programming | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Activating userform and filling it with data form row where userform is activate | Excel Programming | |||
Access from add_in userform to main template userform.... | Excel Programming | |||
Linking userform to userform in Excel 2003 | Excel Programming |