Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 70
Default If Macro Run From Form Control Button/Shape, "Find" Command Not Working

I have an unusual problem and I'm not sure how to fix it. I'm using excel 2007 and I have a workbook that has a series of form buttons programmed to run macros.

On one of the buttons, I have a "stop" command in the macro so that I can manually do a find on a name and then I contine the macro. For some reason, when the macro is launched from the button, pressing "Ctrl+F" or writing the "find" function in the macro, does not appear to do anything. I don't even get a "cannot find what you're looking for" dialog.

What I found is that when the button is pressed, whatever cell is currently selected becomes the "find" area, which is why it is not finding anything. When I select all the cells and do a find, it finds what I'm looking for.

I have tried both a shape and a button to run the macro and both produce the same outcome. I tried to attach a sample workbook to illustrate my problem, but it wouldn't accept the attachment. It should be easy enough to reproduce:

1. Open a new excel workbook and create a new macro with just the word "Stop" in the sub-routine.
2. In the excel workbook, create a form button or shape and assign the macro you just wrote to the button.
3. Write the word "Holiday" in cell "A3"
4. Press the button to run the macro.
2. When the macro stops, select any cell in the workbook (except for cell A3) and do a Ctrl+F and search for "Holiday." You'll see that nothing happens.
3. Select all the cells and do the same thing, and the cell with "Holiday" will be outlined.

Does anyone know why this happens and is there a solution? Thanks!

Last edited by KeriM : September 8th 14 at 04:07 PM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default If Macro Run From Form Control Button/Shape, "Find" Command Not Working

On Monday, September 8, 2014 10:04:20 AM UTC-5, KeriM wrote:
I have an unusual problem and I'm not sure how to fix it. I'm using

excel 2007 and I have a workbook that has a series of form buttons

programmed to run macros.



On one of the buttons, I have a "stop" command in the macro so that I

can manually do a find on a name and then I contine the macro. For some

reason, when the macro is launched from the button, pressing "Ctrl+F" or

writing the "find" function in the macro, does not appear to do

anything. I don't even get a "cannot find what you're looking for"

dialog.



What I found is that when the button is pressed, whatever cell is

currently selected becomes the "find" area, which is why it is not

finding anything. When I select all the cells and do a find, it finds

what I'm looking for.



I have tried both a shape and a button to run the macro and both produce

the same outcome. I tried to attach a sample workbook to illustrate my

problem, but it wouldn't accept the attachment. It should be easy

enough to reproduce:



1. Open a new excel workbook and create a new macro with just the word

"Stop" in the sub-routine.

2. In the excel workbook, create a form button or shape and assign the

macro you just wrote to the button.

3. Write the word "Holiday" in cell "A3"

4. Press the button to run the macro.

2. When the macro stops, select any cell in the workbook (except for

cell A3) and do a Ctrl+F and search for "Holiday." You'll see that

nothing happens.

3. Select all the cells and do the same thing, and the cell with

"Holiday" will be outlined.



Does anyone know why this happens and is there a solution? Thanks!









--

KeriM


post your macro
  #3   Report Post  
Member
 
Posts: 70
Default

Quote:
Originally Posted by View Post
On Monday, September 8, 2014 10:04:20 AM UTC-5, KeriM wrote:
I have an unusual problem and I'm not sure how to fix it. I'm using

excel 2007 and I have a workbook that has a series of form buttons

programmed to run macros.



On one of the buttons, I have a "stop" command in the macro so that I

can manually do a find on a name and then I contine the macro. For some

reason, when the macro is launched from the button, pressing "Ctrl+F" or

writing the "find" function in the macro, does not appear to do

anything. I don't even get a "cannot find what you're looking for"

dialog.



What I found is that when the button is pressed, whatever cell is

currently selected becomes the "find" area, which is why it is not

finding anything. When I select all the cells and do a find, it finds

what I'm looking for.



I have tried both a shape and a button to run the macro and both produce

the same outcome. I tried to attach a sample workbook to illustrate my

problem, but it wouldn't accept the attachment. It should be easy

enough to reproduce:



1. Open a new excel workbook and create a new macro with just the word

"Stop" in the sub-routine.

2. In the excel workbook, create a form button or shape and assign the

macro you just wrote to the button.

3. Write the word "Holiday" in cell "A3"

4. Press the button to run the macro.

2. When the macro stops, select any cell in the workbook (except for

cell A3) and do a Ctrl+F and search for "Holiday." You'll see that

nothing happens.

3. Select all the cells and do the same thing, and the cell with

"Holiday" will be outlined.



Does anyone know why this happens and is there a solution? Thanks!









--

KeriM


post your macro
I couldn't upload a sample workbook from my work computer, but the macro I was using to test it is just:

Code:
Sub Test()
   Stop
End Sub
At the "Stop" is when I'd try to do a find on the workbook while the report was still running the macro.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default If Macro Run From Form Control Button/Shape, "Find" Command Not Working

Code:
--------------------

Sub Test()
Stop
End Sub

--------------------


At the "Stop" is when I'd try to do a find on the workbook while the
report was still running the macro.


You can't execute another macro via the UI so as to interupt code that
is already executing. You have to wait for it to finish.

What you can do is prompt the user for 'Find' criteria and have the
running code process that.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5   Report Post  
Member
 
Posts: 70
Default

Quote:
Originally Posted by GS[_2_] View Post
Code:
--------------------

Sub Test()
Stop
End Sub

--------------------


At the "Stop" is when I'd try to do a find on the workbook while the
report was still running the macro.


You can't execute another macro via the UI so as to interupt code that
is already executing. You have to wait for it to finish.

What you can do is prompt the user for 'Find' criteria and have the
running code process that.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
I know that. I'm not trying to execute another macro while a macro is running. I'm pausing the current macro to manually do a find (ctrl + F) on another sheet in the workbook to fill in data gaps due to data entry errors and then continue the macro that I paused.

For some reason, when the macro is initiated by a button press, the "find" does not search the whole workbook and only searches the currently selected cell. If I initiate the macro within the VBA window, this does not happen. What I want to know is why.

Last edited by KeriM : September 11th 14 at 02:42 PM


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default If Macro Run From Form Control Button/Shape, "Find" Command Not Working

'GS[_2_ Wrote:
;1618581'] Code:-
--------------------

Sub Test()
Stop
End Sub

--------------------


At the "Stop" is when I'd try to do a find on the workbook while
the report was still running the macro.-


You can't execute another macro via the UI so as to interupt code
that is already executing. You have to wait for it to finish.

What you can do is prompt the user for 'Find' criteria and have the
running code process that.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


I know that. I'm not trying to execute another macro while a macro is
running. I'm pausing the current macro to manually do a find (ctrl +
F) on another sheet in the workbook to fill in data gaps due to data
entry errors and then continue the macro that I paused.

For some reason, when the macro is initiated by a button press, the
"find" does not search the whole workbook and only searches the
currently selected cell. If I initiate the macro within the VBA
window, this does not happen. What I want to know is why.


While code is "in play", Excel usually forbids any interaction until
that code "ends" -OR- the code itself prompts the user for interactive
input via an appropriate method.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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
How to have a macro simply issue the "find" command or "control f: Charles Adams Excel Programming 3 February 6th 09 06:34 PM
"Form / Button" Macro for Unhiding Sheets Melissa Excel Discussion (Misc queries) 0 September 5th 08 06:07 PM
Macro for "Next" Button on User Form? Goth Excel Programming 1 December 4th 07 02:38 AM
command button and the "enter" and "tab" keys dr chuck Excel Programming 10 September 11th 06 12:09 AM
set up a command button or macro for open file to "save as" Mo Excel Programming 1 June 23rd 05 12:19 AM


All times are GMT +1. The time now is 07:50 AM.

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

About Us

"It's about Microsoft Excel"