#1   Report Post  
Posted to microsoft.public.excel.misc
BB
 
Posts: n/a
Default Programming help

Hey I am trying to design a small spreadsheet in which you have a choice
between two options, one in column E and one in column F. Is there a way in
VBA to make it possible to double click on the choice that you pick and for
that choice to then show up in another column, H.

Is this too complicated and is there an easier way to do this? Thanks in
advance for your help.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Rowan Drummond
 
Posts: n/a
Default Programming help

One way would be to use the worksheet doubleclick event. Right click the
sheet tab, select view code and paste the following event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range _
, Cancel As Boolean)
On Error GoTo Exit_Event
Application.EnableEvents = False

If Target.Count = 1 Then
If Target.Column = 5 Or Target.Column = 6 Then
Cells(Target.Row, 8).Value = Target.Value
End If
End If
Cancel = True

Exit_Event:
Application.EnableEvents = True
End Sub

Hope this helps
Rowan

BB wrote:
Hey I am trying to design a small spreadsheet in which you have a choice
between two options, one in column E and one in column F. Is there a way in
VBA to make it possible to double click on the choice that you pick and for
that choice to then show up in another column, H.

Is this too complicated and is there an easier way to do this? Thanks in
advance for your help.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default Programming help

Would this be a good place to use Data Validation?:
That would put both options on a drop-down list. The user would then just
pick one of the items and it would be selected.

Select the option cell
DataData Validation
Allow: List
Source: Option1, Option2 (just type in the items separated by commas.)
Click OK

Does that help?

***********
Regards,
Ron


"BB" wrote:

Hey I am trying to design a small spreadsheet in which you have a choice
between two options, one in column E and one in column F. Is there a way in
VBA to make it possible to double click on the choice that you pick and for
that choice to then show up in another column, H.

Is this too complicated and is there an easier way to do this? Thanks in
advance for your help.

  #4   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie
 
Posts: n/a
Default Programming help

This should get you started:
http://www.mvps.org/dmcritchie/excel/event.htm

you would use target.column = 5 to check for column E
and target.column = 6 to check for column F

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Target.Column < 5 Or Target.Column 6 Then Exit Sub
Cells(Target.row, 7) = Target.Column
End Sub

to install right click on the sheet tab, view code
place the code under the Option Explicit
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"BB" wrote in message ...
Hey I am trying to design a small spreadsheet in which you have a choice
between two options, one in column E and one in column F. Is there a way in
VBA to make it possible to double click on the choice that you pick and for
that choice to then show up in another column, H.

Is this too complicated and is there an easier way to do this? Thanks in
advance for your help.




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
using programming to copy worksheets data only maxzsim Excel Discussion (Misc queries) 1 November 29th 05 05:02 PM
Excel is written in which programming language ? Shrikant Excel Discussion (Misc queries) 1 September 1st 05 10:58 AM
Excel/VBA programming Carlos A Excel Discussion (Misc queries) 2 July 24th 05 10:21 PM
Does what I'm trying to do require programming? QCEinMS Excel Discussion (Misc queries) 1 February 17th 05 11:23 PM
Linear Programming Franklin Excel Discussion (Misc queries) 1 January 22nd 05 09:27 PM


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