Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA event trigger problem

I'm building an Excel VBA questionnaire where I use List Box (in forms
to collect answers on questions. My intention is to create a routin
that enters the date and time in a cell when an item is selected in th
ListBox. I've tried:
Private Sub Worksheet_Change(ByVal Target As Range) and OnEntry.

These work perfect as long as I manually enter a value in a cell or us
a varible to insert a value in a cell. However it does not react to
cell being updated with a value as a reaction of a selection in th
ListBox.

Has anybody got a remedy?

Mill

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Excel VBA event trigger problem

Hi Milli

Listboxes have also events.
Run your code in one of this events

Private Sub ListBox1_Click()

End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Milli " wrote in message ...
I'm building an Excel VBA questionnaire where I use List Box (in forms)
to collect answers on questions. My intention is to create a routine
that enters the date and time in a cell when an item is selected in the
ListBox. I've tried:
Private Sub Worksheet_Change(ByVal Target As Range) and OnEntry.

These work perfect as long as I manually enter a value in a cell or use
a varible to insert a value in a cell. However it does not react to a
cell being updated with a value as a reaction of a selection in the
ListBox.

Has anybody got a remedy?

Milli


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA event trigger problem

Thanks, that helps me to understand my problem. However:
I produce the questionnaires including ListBoxes from a master routine
so the different questionnaires dosen't really contain any code at all
There's a total of about 1000 questions in a dozen workbooks and som
100 worksheets. So, I don't know the name of the different ListBoxes.
need to find the address of the LinkedCell of the ListBox that i
currently activated, then I can just add a macro to the ListBox.
I can't find a way to read the LinkedCell of the current ListBox into
variable!
I've attached a simplified file that shows my problem.

Milli

Ron de Bruin wrote:
*Hi Milli

Listboxes have also events.
Run your code in one of this events

Private Sub ListBox1_Click()

End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Milli " wrote in messag
...
I'm building an Excel VBA questionnaire where I use List Box (i

forms)
to collect answers on questions. My intention is to create

routine
that enters the date and time in a cell when an item is selected i

the
ListBox. I've tried:
Private Sub Worksheet_Change(ByVal Target As Range) and OnEntry.

These work perfect as long as I manually enter a value in a cell o

use
a varible to insert a value in a cell. However it does not react t

a
cell being updated with a value as a reaction of a selection i

the
ListBox.

Has anybody got a remedy?

Milli


---
Message posted from http://www.ExcelForum.com/


Attachment filename: event_trigger_problem.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=52264
--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA event trigger problem

I have solved my problem. I used Application.Caller, looks somethin
like this:
strX = Application.Caller
vntY = DocHasShapes.Shapes(strX).ControlFormat.LinkedCell

Mill

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA event trigger problem

How about using the Listbox_Click Event on the Worksheet
you could then run the Subroutine through this event.

i.e. if you already have an instance of Worksheet_Change then
you could add into the Listbox_Click Event

something Like

Private Sub ListBox1_Click()
MyText = ListBox1.Value
Range("A1").Value = MyText
Call Worksheet_Change(Range("A2"))
End Sub

Hope this helps

Davi

--
Message posted from http://www.ExcelForum.com



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
Textbox added to Form at runtime too small, can't control size andchange event won't trigger RCGUA Excel Worksheet Functions 2 December 10th 08 09:34 PM
Textbox added to Form at runtime too small, can't control size andchange event won't trigger RCGUA Excel Worksheet Functions 0 December 10th 08 07:48 PM
Trigger Event on Format Change Zone[_3_] Excel Discussion (Misc queries) 4 August 25th 07 05:43 PM


All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"