Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hello all.
I want to run a macro only: if Field E10 = "WO ID" and AB10 = "Spec Sizing" if fields are different then it must show a message saying that the file is not the correct one. 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 the code? please help Thanks in advanced -- Lorenzo DÃ*az Cad Technician |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
to run, the macro must be in an open file. put it in a general module in the file that you will be running the macro. open the vb editor....Alt+F11 if the code window (big one, far right) is gray.... on the tool bar... insertmodule paste your code in the code window. save the file. Sub yoursub() if range("E10").value ="WO ID" and range("AB10").value = "Spec Sizing" then your code here else msgbox "wrong file!" end if end sub alter possiblity.... Sub yoursub() if activeworkbook.name = yourworkbookname then your code here else msgbox "wrong file!" end if end sub regards FSt1 "ldiaz" wrote: hello all. I want to run a macro only: if Field E10 = "WO ID" and AB10 = "Spec Sizing" if fields are different then it must show a message saying that the file is not the correct one. 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 the code? please help Thanks in advanced -- Lorenzo DÃ*az Cad Technician |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
That's great,
it works perfectly Thanks -- Lorenzo DÃ*az Cad Technician "FSt1" wrote: hi to run, the macro must be in an open file. put it in a general module in the file that you will be running the macro. open the vb editor....Alt+F11 if the code window (big one, far right) is gray.... on the tool bar... insertmodule paste your code in the code window. save the file. Sub yoursub() if range("E10").value ="WO ID" and range("AB10").value = "Spec Sizing" then your code here else msgbox "wrong file!" end if end sub alter possiblity.... Sub yoursub() if activeworkbook.name = yourworkbookname then your code here else msgbox "wrong file!" end if end sub regards FSt1 "ldiaz" wrote: hello all. I want to run a macro only: if Field E10 = "WO ID" and AB10 = "Spec Sizing" if fields are different then it must show a message saying that the file is not the correct one. 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 the code? please help Thanks in advanced -- Lorenzo DÃ*az Cad Technician |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |