Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hi there...
I have a little problem i hope someone could help me
with... How can i get Excel to check if a specific cell is entered, and when this specific cell is entered run a function??? e.g. I wish to run function: show_graph when the user scrolls, clicks or enters cell("B19"). I seem to have some understanding of it, but my function needs that the user press enter in the desired cell. I wish to activate the function even if the user scrolls through it. I hope that someone knows how. Thx in advance S.S.Sander |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hi there...
Hi,
Place the following code in your workbooks' ThisWorkbook object foudn in your workbooks' project window Microsoft Excel Objects. Option Explicit Dim MyxlApp As New clsMyxlAppEvents Private Sub Workbook_Open() Set MyxlApp.xlApp = Application End Sub Create a class module called clsMyxlAppEvents and from the object combo box (has the word 'General' in it) select the item xlApp use the procedure combo box to select SheetSelectionChange. You will now look and an empty procedure. This procedure will run each time the users moves to a cell. Since you only want to do something when cell B19 in your workbook you'll need code like this. Target is the paramter passed in by the function and represent the selected cell range. Dim varReturn as Variant If application.activeworkbook.name < "MyWorkbook" then exit sub If Target.Row = 19 And Target.Column = 2 then 'run your Public function here varReturn = fncMyFunction if varReturn then msgbox "My Function was executed" end if Hope this helps regards KM -----Original Message----- I have a little problem i hope someone could help me with... How can i get Excel to check if a specific cell is entered, and when this specific cell is entered run a function??? e.g. I wish to run function: show_graph when the user scrolls, clicks or enters cell("B19"). I seem to have some understanding of it, but my function needs that the user press enter in the desired cell. I wish to activate the function even if the user scrolls through it. I hope that someone knows how. Thx in advance S.S.Sander . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hi there...
Hi again....
For some reason, unknown to me, are there not a xlApp option, there´s simply a class option, in the object combo box. Could the reason be that i´m in office 2000 (win98) ?? Again thx in advance S.S.Sander -----Original Message----- Hi, Place the following code in your workbooks' ThisWorkbook object foudn in your workbooks' project window Microsoft Excel Objects. Option Explicit Dim MyxlApp As New clsMyxlAppEvents Private Sub Workbook_Open() Set MyxlApp.xlApp = Application End Sub Create a class module called clsMyxlAppEvents and from the object combo box (has the word 'General' in it) select the item xlApp use the procedure combo box to select SheetSelectionChange. You will now look and an empty procedure. This procedure will run each time the users moves to a cell. Since you only want to do something when cell B19 in your workbook you'll need code like this. Target is the paramter passed in by the function and represent the selected cell range. Dim varReturn as Variant If application.activeworkbook.name < "MyWorkbook" then exit sub If Target.Row = 19 And Target.Column = 2 then 'run your Public function here varReturn = fncMyFunction if varReturn then msgbox "My Function was executed" end if Hope this helps regards KM -----Original Message----- I have a little problem i hope someone could help me with... How can i get Excel to check if a specific cell is entered, and when this specific cell is entered run a function??? e.g. I wish to run function: show_graph when the user scrolls, clicks or enters cell("B19"). I seem to have some understanding of it, but my function needs that the user press enter in the desired cell. I wish to activate the function even if the user scrolls through it. I hope that someone knows how. Thx in advance S.S.Sander . . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hi there...
I think you missed out the bit about
Private WithEvents xlApp As Excel.Application in the General Declarations of the class module. -- "Kevin McCartney" wrote in message ... Hi, Place the following code in your workbooks' ThisWorkbook object foudn in your workbooks' project window Microsoft Excel Objects. Option Explicit Dim MyxlApp As New clsMyxlAppEvents Private Sub Workbook_Open() Set MyxlApp.xlApp = Application End Sub Create a class module called clsMyxlAppEvents and from the object combo box (has the word 'General' in it) select the item xlApp use the procedure combo box to select SheetSelectionChange. You will now look and an empty procedure. This procedure will run each time the users moves to a cell. Since you only want to do something when cell B19 in your workbook you'll need code like this. Target is the paramter passed in by the function and represent the selected cell range. Dim varReturn as Variant If application.activeworkbook.name < "MyWorkbook" then exit sub If Target.Row = 19 And Target.Column = 2 then 'run your Public function here varReturn = fncMyFunction if varReturn then msgbox "My Function was executed" end if Hope this helps regards KM -----Original Message----- I have a little problem i hope someone could help me with... How can i get Excel to check if a specific cell is entered, and when this specific cell is entered run a function??? e.g. I wish to run function: show_graph when the user scrolls, clicks or enters cell("B19"). I seem to have some understanding of it, but my function needs that the user press enter in the desired cell. I wish to activate the function even if the user scrolls through it. I hope that someone knows how. Thx in advance S.S.Sander . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|