Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dj dj is offline
external usenet poster
 
Posts: 92
Default Adding a button to a VB form

Very VB novice - have basic form which is being used to fill a database. Need
to add 4 buttons which will be used to determine what type of data is coming
in i.e. question, comment, idea etc.

All work - can see buttons on form but when I select one of them when I run
get TRUE or FALSE in relevant column.

What do I need to do to get text as outlined above?
--
DJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Adding a button to a VB form

Part 1:
Button usually refers to command button, but in your case it looks like
either an option button (circle with dot) or a checkbox, since both ot these
types have values of True or False.

Part 2:
Assuming that the "buttons" are option buttons, then you can add code to
them by entering design mode and right clicking the button and then select
"View Code" from the pop up menu. Add code similar to this:

Private Sub OptionButton1_Click()
If Me.OptionButton1.Value = True Then
ActiveSheet.Range("A1") = "Question"
End If
Me.OptionButton1.Value = False
End Sub

You would need to change A1 to the appropriate cell reference, for each
OptionButton and assign the appropriate type of incoming data.

If you are using a command button, then you would not need the If statement.

Private Sub CommandButton1_Click()
ActiveSheet.Range("A1") = "Question"
End If




"DJ" wrote in message
...
Very VB novice - have basic form which is being used to fill a database.
Need
to add 4 buttons which will be used to determine what type of data is
coming
in i.e. question, comment, idea etc.

All work - can see buttons on form but when I select one of them when I
run
get TRUE or FALSE in relevant column.

What do I need to do to get text as outlined above?
--
DJ



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
Change from a Command Button to a Form Button Ben in CA[_2_] Excel Programming 4 December 11th 08 10:05 PM
Form Button vs Command Button Gizmo Excel Programming 2 April 8th 08 08:16 PM
Adding and Graying MAXIMIZE button on vba E2007 form system menu Tom Excel Programming 2 February 23rd 08 08:42 AM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


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