Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listbox in UserForm | Excel Discussion (Misc queries) | |||
how to drag and drop from a listbox to activecell with vba ? | Excel Programming | |||
userform listbox cannot get listbox.value to transfer back to main sub | Excel Programming | |||
Paste Multiple listbox items starting at ActiveCell | Excel Programming | |||
UserForm Listbox in VBC | Excel Discussion (Misc queries) |