Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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 to enter values and shown in same userform in list helmekki[_104_] Excel Programming 0 November 19th 05 03:23 PM
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Activating userform and filling it with data form row where userform is activate Marthijn Beusekom via OfficeKB.com[_2_] Excel Programming 3 May 6th 05 05:44 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM


All times are GMT +1. The time now is 08:39 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"