Solved

Macro has to work for 2 workbooks

Posted on 2011-03-25
3
185 Views
Last Modified: 2012-05-11
Hi,

I have 2 spreadsheet, Book1 en Book2.
I start Book1 and automatically in de OnOpen events starts the macro.
A number of functions are executed and then spreadsheet Book2 will be openend.
Now de execution of the macro should be stopped temporarily. The user has to change 1 field in Book2 and then the processing of the macro has to be continued.
I have tried a lot of code but i can't stop the macro temporarily.

gtz
0
Comment
Question by:sonmic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35214063
Here is one way.

Paste this in a module. The second part of the macro will continue after 15 seconds so the user has 15 seconds to make the changes. You may amend that as applicable.

Sub Sample()
    Dim wb1 As Workbook, wb2 As Workbook
    
    Set wb1 = ActiveWorkbook
    
    Set wb2 = Workbooks.Open("C:\Book2.xls")
    
    '~~> Wait for 15 seconds
    Application.OnTime Now() + TimeValue("00:00:15"), "ContinueCode"

End Sub

Sub ContinueCode()
    MsgBox "Macro Continues"
End Sub

Open in new window


Sid
0
 
LVL 6

Accepted Solution

by:
KnutsonBM earned 500 total points
ID: 35214069
you can create an Input Box

Dim Users Text as String

UsersText = InputBox("Description of Text to Be input", _InputTitle","Explain what to Input")
Cells(x,y).Value = UsersText
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 35214072
the input box makes it so you don't have to have a preset amount of time to pause the code, and the code doesn't continue until the text is input
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Populate a cell value from a dropdown list 12 64
Unable to save Excel document because of errors 6 25
Lookup - Vlookup 9 49
any combination of this numbers 9 33
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question