Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Userform, listbox and ActiveCell. I'm stumped

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Userform, listbox and ActiveCell. I'm stumped

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Userform, listbox and ActiveCell. I'm stumped

Dave,
Not sure what you exact problem is or the relevance of 'C!A10:A20', but

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
UserForm1.Show vbModal
End Sub

'UserForm1 code
Private Sub CommandButton1_Click()
ActiveCell.Value = Now() + 5
Unload Me
End Sub

NickHK

"DaveyJones" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Userform, listbox and ActiveCell. I'm stumped

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
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


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
Listbox in UserForm Dale Fye Excel Discussion (Misc queries) 0 October 11th 07 09:40 PM
how to drag and drop from a listbox to activecell with vba ? ka Excel Programming 2 June 24th 06 02:15 PM
userform listbox cannot get listbox.value to transfer back to main sub [email protected] Excel Programming 1 May 17th 06 09:44 PM
Paste Multiple listbox items starting at ActiveCell Casey[_67_] Excel Programming 5 April 8th 06 07:45 PM
UserForm Listbox in VBC Marcia3641 Excel Discussion (Misc queries) 7 July 22nd 05 10:20 AM


All times are GMT +1. The time now is 12:18 PM.

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"