Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Pressing "Enter" to run macro

thanks Binzelli!
It works great

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Make "Edit" mode default, rather than "Enter"? Greg Boettcher Excel Discussion (Misc queries) 1 July 27th 06 01:46 AM
colour fonts revert to black when pressing "Enter" BAB Excel Discussion (Misc queries) 5 February 22nd 06 06:45 PM
How do I turn on "pressing enter goes to the next cell" option? Hollywood Excel Discussion (Misc queries) 6 December 20th 05 09:10 PM
pressing the "reset" button and freeing memory Elie W Excel Programming 1 February 12th 04 07:44 PM


All times are GMT +1. The time now is 08:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"