View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] halimnurikhwan@yahoo.com is offline
external usenet poster
 
Posts: 113
Default Userform, listbox and ActiveCell. I'm stumped

Hi ,

Try this one :

Private Sub ListBox1_Click()
ActiveCell.Value = ListBox1.Value
End Sub


Rgds,

Halim


DaveyJones menuliskan:
The First part of the code works fine and the userform opens up. But when i
click on a date in the list box it does not automatically input the value i
clicked on. Is it possible to do this or will I just have to use a command
button below it? So highlight the value and click on a button.


--
Dave


"Halim" wrote:

Hi,

Try this:
to load userform :
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
UserForm1.Show 0
End Sub

To close userform:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If UserForm1.Visible Then If Target.Value = "Close" Then Unload UserForm1
End Sub


Rgds,

Halim


"DaveyJones" wrote:

My project, after many weeks, is nearly finished. I have just got to input
some date values.

I am going to use a right click event to open a userform with a listbox then
the user can click on an entry in the listbox. Then the userform closes with
the value clicked on in the ActiveCell(or cell that was right clicked on to
open userform).

I have trawled through many online tutorials but non seem to deal with this
kind of problem. The data is todays date +- 5 working days In 'C!A10:A20'.
That I have dealt with. I just need to get the yuserform to work. Any help
would be greatly appreciated...


--
Dave