Problems with excel

  • Thread starter Thread starter Israel Moreno
  • Start date Start date
I

Israel Moreno

Hi everybody,

My question is this. How i run a visual basic's function in one cell of excel?

Excuseme for my grammar's problem but i spanish.


Thanks.
 
Hi

if you want the code to run when the value in a cell is changed or meets a
certain criteria you can do this through a worksheet_change event (right
mouse click on the relevant sheet tab and choose view code) e.g.

Private Sub Worksheet_Change(ByVal Target As Range)

application.enableevents = false
on error goto err_handler
if target.address = "$A$1" and target.value = 1 then
'your code here
end if

err_handler:
application.enableevents = true
End Sub
---
this says ... if cell A1 has changed and the value in this cell is 1 run the
code

Hope this helps
Cheers
JulieD
 
Hi Israel,


if your VBA function is called e.g. "function1()", simply
use

=function1()

as the cell formula and it should work.

Best

Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top