Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
I have an imput box in cell F5. The only things that can be imputte
inside that cell is a dollar amount. I want a macro to run only after someone has entered a number in tha cell and right after he/she imputs the amount and presses Enter. Can this be done in this manner or will I still need to place a butto next to the cell to click once an amount has been imputted? Thanks, I appreciate the help -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
even better. It can be automatic
right click sheet tabview codecopy/paste this. Change cell to suit. Use A instead of a. Private Sub Worksheet_Change(ByVal Target As Range) if target.address="$A$1" then call mymacro End Sub -- Don Guillett SalesAid Software "grin2000 " wrote in message ... I have an imput box in cell F5. The only things that can be imputted inside that cell is a dollar amount. I want a macro to run only after someone has entered a number in that cell and right after he/she imputs the amount and presses Enter. Can this be done in this manner or will I still need to place a button next to the cell to click once an amount has been imputted? Thanks, I appreciate the help. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
I tried it and it gives my
"Compile error: Sub or Function not defined" the cell is f73 that I want to run so I put $F$73 but it gives me thi erro -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
do you have a macro named mymacro?
-- Regards, Tom Ogilvy "grin2000 " wrote in message ... I tried it and it gives my "Compile error: Sub or Function not defined" the cell is f73 that I want to run so I put $F$73 but it gives me this error --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
no it's called Test and I did change it to that but it still gives m
that erro -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
Grin,
what you probably did is copy the exact code Don gave you. When cel F73 changes it calls the Sub "mymacro", which Don put in the code as a example of a Sub to run if the cell has changed. I don't know what you want to happen when the cell changes, but you ca approach it in two ways. The first is to put the code right in th Worksheet_Change event. The second is to call another Sub when the cel changes: FIRST: Code ------------------- Private Sub Worksheet_Change(ByVal Target As Range) If target.address="$F$73" then 'Write whatever code is needed, for example: MsgBox ("Cell F73 has changed to value: " & Target.Value) end if End Sub ------------------- SECOND: Code ------------------- Private Sub Worksheet_Change(ByVal Target As Range) if target.address="$F$73" then call GrinsMacro(Target) end if End Sub Sub GrinsMacro(Target As Range) 'Write whatever code is needed, for example: MsgBox ("Cell F73 has changed to value: " & Target.Value) End Sub ------------------- Good luck -- Message posted from http://www.ExcelForum.com |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
This goes into the code module for the sheet (right click tab & Vie
Cose). '------------------------------------------------- Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Address = "$F$5" Then MsgBox ("Put code here.") End If End Sub '----------------------------------------------------- -- Message posted from http://www.ExcelForum.com |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
"grin2000 " skrev i melding
... no it's called Test and I did change it to that but it still gives me that error Test should be in the same module or in a standard module. If it's in another sheet module then it must be addressed like this: Call Sheet2.Test HTH. Best wishes Harald |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
Great tip!
I don't understand what you mean by "Use A instead of a." -----Original Message----- even better. It can be automatic right click sheet tabview codecopy/paste this. Change cell to suit. Use A instead of a. Private Sub Worksheet_Change(ByVal Target As Range) if target.address="$A$1" then call mymacro End Sub -- Don Guillett SalesAid Software "grin2000 " wrote in message ... I have an imput box in cell F5. The only things that can be imputted inside that cell is a dollar amount. I want a macro to run only after someone has entered a number in that cell and right after he/she imputs the amount and presses Enter. Can this be done in this manner or will I still need to place a button next to the cell to click once an amount has been imputted? Thanks, I appreciate the help. --- Message posted from http://www.ExcelForum.com/ . |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pressing "Enter" to run macro
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! | Excel Discussion (Misc queries) | |||
Make "Edit" mode default, rather than "Enter"? | Excel Discussion (Misc queries) | |||
colour fonts revert to black when pressing "Enter" | Excel Discussion (Misc queries) | |||
How do I turn on "pressing enter goes to the next cell" option? | Excel Discussion (Misc queries) | |||
pressing the "reset" button and freeing memory | Excel Programming |