Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]() Quote:
Code:
Sub Test() Stop End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]() Quote:
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to have a macro simply issue the "find" command or "control f: | Excel Programming | |||
"Form / Button" Macro for Unhiding Sheets | Excel Discussion (Misc queries) | |||
Macro for "Next" Button on User Form? | Excel Programming | |||
command button and the "enter" and "tab" keys | Excel Programming | |||
set up a command button or macro for open file to "save as" | Excel Programming |