ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" (https://www.excelbanter.com/excel-discussion-misc-queries/180187-run-macro-only-if-field-e10-%3D-wo-id-ab10-%3D-spec-sizing.html)

ldiaz

Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing"
 

hello all.

I want to run a macro only:
if Field E10 = "WO ID" and AB10 = "Spec Sizing"

if field are different then it must show a message saying that the file is
not the correct one.

please help

Thanks
--
Lorenzo DÃ*az
Cad Technician

Mike H

Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing"
 
Maybe this,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("E10,AB10")) Is Nothing Then
If Range("E10").Value = "WO OD" And Range("AB10").Value = "Spec
Sizing" Then
MsgBox "Macro OK to go"
'do something
Else
MsgBox "wrong file"
End If
End If
End Sub

Mike

"ldiaz" wrote:


hello all.

I want to run a macro only:
if Field E10 = "WO ID" and AB10 = "Spec Sizing"

if field are different then it must show a message saying that the file is
not the correct one.

please help

Thanks
--
Lorenzo DÃ*az
Cad Technician


ldiaz

Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing"
 

my macro needs Ctrl + m key to run,

and start llike this:

Sub Shipping()
' Keyboard Shortcut: Ctrl+m
'start Macro
Statement
'End macro
End Sub

where do I need to put your code?


--
Lorenzo DÃ*az
Cad Technician


"Mike H" wrote:

Maybe this,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("E10,AB10")) Is Nothing Then
If Range("E10").Value = "WO OD" And Range("AB10").Value = "Spec
Sizing" Then
MsgBox "Macro OK to go"
'do something
Else
MsgBox "wrong file"
End If
End If
End Sub

Mike

"ldiaz" wrote:


hello all.

I want to run a macro only:
if Field E10 = "WO ID" and AB10 = "Spec Sizing"

if field are different then it must show a message saying that the file is
not the correct one.

please help

Thanks
--
Lorenzo DÃ*az
Cad Technician



All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com