Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear
Ihave macro below i want to run this when i enter data in cell "D10" please help Sub macro2() Dim varAnswer As String varAnswer = MsgBox("please insure that all data is i thousands?", vbYesNo, "Warning") If varAnswer = vbNo Then Exit Sub End If End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Put this in the worksheet code module *Private Sub Worksheet_Change(ByVal Target As Range) If target.cells.count 1 then exit su If Not Intersect(Target, Range("D10")) Is Nothing The MsgBox "This is" & Target.Addres 'Call Macro2 ''uncomment this to run your cod End I *End Sub -- Simon Lloy Regards Simon Lloy 'The Code Cage' (http://www.thecodecage.com ----------------------------------------------------------------------- Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid= View this thread: http://www.thecodecage.com/forumz/showthread.php?t=3413 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a similar issue. I want to run one of my macros based on conditional
results of a formula. For example, if cell XXXX is TRUE, then run macro, else don't. I was searching help file, but I can't see refernce to VB code that will run based on cell value or a formula that I can enter to activate said macro. Help please.... Thanks, Daryl Balcom Honeywell "Simon Lloyd" wrote: Put this in the worksheet code module: *Private Sub Worksheet_Change(ByVal Target As Range)* If target.cells.count 1 then exit sub If Not Intersect(Target, Range("D10")) Is Nothing Then MsgBox "This is" & Target.Address 'Call Macro2 ''uncomment this to run your code End If *End Sub* -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34136 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The code supplied works only when D10 is changed, you can use the same principle. -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34136 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks. I tried to do that (actually using D10) and it wouldn't call my
macro when I entered something in the cell. The macro works independently, but not through the code you provided. I added it to the VB code of my macro. I just made a silly macro to try out the function: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.count 1 Then Exit Sub If Not Intersect(Target, Range("D10")) Is Nothing Then MsgBox "This is" & Target.Address Call TEST End If End Sub Sub TEST() ' ' TEST Macro ' Macro recorded 11/26/2008 by Honeywell ' ' Range("E1").Select ActiveCell.FormulaR1C1 = "TEST" Range("E2").Select End Sub "Simon Lloyd" wrote: The code supplied works only when D10 is changed, you can use the same principle. -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34136 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your posted code works for me when I change D10.
But if D10 is a calcualted value of TRUE or FALSE you need a calculate event, not a change event. Private Sub Worksheet_Calculate() If Me.Range("D10").Value = -1 Then '-1 is TRUE, 0 is FALSE Call TEST End If End Sub Sub TEST() ' ' TEST Macro ' Macro recorded 11/26/2008 by Honeywell ' ' Range("E1").Select ActiveCell.FormulaR1C1 = "TEST" Range("E2").Select End Sub Gord Dibben MS Excel MVP On Wed, 26 Nov 2008 13:36:01 -0800, Daryl - Honeywell wrote: Thanks. I tried to do that (actually using D10) and it wouldn't call my macro when I entered something in the cell. The macro works independently, but not through the code you provided. I added it to the VB code of my macro. I just made a silly macro to try out the function: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.count 1 Then Exit Sub If Not Intersect(Target, Range("D10")) Is Nothing Then MsgBox "This is" & Target.Address Call TEST End If End Sub Sub TEST() ' ' TEST Macro ' Macro recorded 11/26/2008 by Honeywell ' ' Range("E1").Select ActiveCell.FormulaR1C1 = "TEST" Range("E2").Select End Sub "Simon Lloyd" wrote: The code supplied works only when D10 is changed, you can use the same principle. -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34136 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Gordon i realised i should have mentioned that to the OP shortly after posting! ;) -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34136 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |