Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do I ensure enter is pressed

I have a simple macro (below) that invokes the advanced filter criteria
but it fails to refresh if the user is still "in" the filed wher
criteria is being input.

How can I ensure that the data entry field has had an ENTER or TA
pressed before the rest of the macro runs.

Thanks, Simon

Sub mh_apply_filter()
'
' mh_apply_filter Macro
' To allow refresh of the filtering. Macro recorded 27/02/2004 b
administrator
'
'
Range("F10").Select
Range("A10:AB210").AdvancedFilter Action:=xlFilterInPlace
CriteriaRange:= _
Range("C7:C8"), Unique:=False
End Su

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default how do I ensure enter is pressed

If the user is editing a worksheet cell, all VBA functionality is
suspended. So, your macro cannot start until the user completes data
entry.

If the user is editing something else, you have to explain what, where,
and how.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , busyman5_au
says...
I have a simple macro (below) that invokes the advanced filter criteria,
but it fails to refresh if the user is still "in" the filed where
criteria is being input.

How can I ensure that the data entry field has had an ENTER or TAB
pressed before the rest of the macro runs.

Thanks, Simon

Sub mh_apply_filter()
'
' mh_apply_filter Macro
' To allow refresh of the filtering. Macro recorded 27/02/2004 by
administrator
'
'
Range("F10").Select
Range("A10:AB210").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _
Range("C7:C8"), Unique:=False
End Sub


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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do I ensure enter is pressed

They are entering a value into the cell set up for the criteria, in thi
case C7.

So at the moment I have a pair of cells holding criteria (filter colum
label and value) and next to it a nice big button saying APPLY FILTER
But unless thee the user moves off the criteria value cell there i
no effect when they invoke the macro. Which is not very intuitive fo
novice users.

Thanks for continued thinking on this matter

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default how do I ensure enter is pressed

As far as I know, that has always been the way XL has worked. No VBA
code can run as long as the user is editing a cell.

You could make things more complicated for yourself by disabling the
button until the cell of interest is changed. In the example below, I
assumed that there can be two criteria, specified in E5:F5. The button
next to the criteria range is called CommandButton1

Option Explicit

Private Sub CommandButton1_Click()
MsgBox "hello"
Me.CommandButton1.Enabled = False
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, _
Target.Parent.Range("e5:F5")) Is Nothing Then
Exit Sub
End If
Me.CommandButton1.Enabled = True
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , busyman5_au
says...
They are entering a value into the cell set up for the criteria, in this
case C7.

So at the moment I have a pair of cells holding criteria (filter column
label and value) and next to it a nice big button saying APPLY FILTER.
But unless thee the user moves off the criteria value cell there is
no effect when they invoke the macro. Which is not very intuitive for
novice users.

Thanks for continued thinking on this matter.


---
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
When enter key is pressed, cursor does not move to next cell in Ex Blackie Excel Discussion (Misc queries) 3 April 19th 23 02:10 PM
how do I change which cell becomes active when enter is pressed? scotpiper Excel Discussion (Misc queries) 1 April 7th 09 12:18 AM
Excel2007 Stipulate where cursor goes when Enter Key pressed RonG Excel Discussion (Misc queries) 5 March 9th 09 09:59 PM
Moving between cells when enter is pressed woalmoore Excel Discussion (Misc queries) 3 July 18th 08 04:24 PM
Enter pressed in Textbox embarrased Excel Programming 6 February 5th 04 06:24 PM


All times are GMT +1. The time now is 06:26 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"