Hi.
I am using excel 2010 and I’m facing a problem. Maybe someone can help me.
I have created 3 different macros, but I want to run them with only one click.
The big problem is that the second macro should run only when the first is finished, and the third should only run when the second is finished.
Any tip?
Regards:
Bruno
Sub Main() Macro1 Macro2 Macro3 End Sub Sub Macro1() MsgBox 1 Exit Sub Sub Macro2() MsgBox 2 Exit Sub Sub Macro3() MsgBox 3 Exit Sub
Regards
To assign this command to a button, I only have to copy that command, changing the macros name, isn't it?
But it don't work![]()
You just run Main from the button
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Hi,
This code don't solve my problem!
My first macro takes too long to be updated, and the second one should only start when the first one is conclude.
The biggeste problem is the second macro starts when the first one is still running.
Hi,
I'm spending to much time to solve this question, but i don't fina a solution.
Anyone can help me, please.
I think we'd need to see what your macros do to understand how the second can start before the first has finished. In theory, the example described earlier will (can only) execute the macros sequentially. It is, therefore, hard to understand why that is not the case for you.
Please post the code and/or a sample workbook (with the code).
Regards
My Macro Actualizar takes too long.
When the third macro start, the first one is not conclude.
I solve this question run each one individually.
My Code
Macro Actualiza
Sub Actualizar()
ActiveWorkbook.RefreshAll
End Sub
Macro Botão9_Click
Sub Botão9_Click()
Sheets("ANÁLISE").Select
Range("B1:S74").Select
Range("B2").Activate
ActiveWorkbook.RefreshAll
End Sub
Macro Configurar
Sub Configurar()
Sheets("DETALHE").Select
Cells.Replace What:="JOÃO ROLDÃO", Replacement:="JOAO ROLDAO", LookAt:= _
xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets("ANÁLISE").Select
Sheets("VENDAS CL").Visible = True
Sheets("VENDAS CL").Select
Range("A44").Select
Cells.Replace What:="ELETTROCANALLI", Replacement:="ELETTROCANALI", LookAt _
:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False _
, ReplaceFormat:=False
Cells.Replace What:="ITW", Replacement:="ITW(ELEMATIC)", LookAt:=xlWhole _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:="TARGETTI", Replacement:="TARGETTI(ESEDRA)", LookAt:= _
xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("A48").Select
Selection.ClearContents
Range("A47").Select
Selection.ClearContents
Range("A45").Select
Selection.ClearContents
Range("A47").Select
ActiveCell.FormulaR1C1 = "CABOS ESPECIAIS"
Range("A48").Select
Sheets("VENDAS CL").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("ANÁLISE").Select
Range("A1:A2").Select
End Sub
Now I have to ask you to follow the forum rules and add Code Tags to your code examples.
Can you also clarify if you have followed the original guidance and indicate what macro you use to call the others and what order they are called.
Thanks
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Hi,
If you don't mind, i attach my file.
I'm a beginner with macros, and should have a big mistake!!
In the code, when the first macro is finish it should call the second and at the end of the second macro should call the third macro.
But the first one take some time, because it is a update in our intranet.
Regards
I am not seeing the command to call the 2nd macro in your first macro.
on the first macro (actualizar) i put a code Call to call de 2nd macro (Botão9_Click).
I think it's right, isn't it?
I have asked you to add Code tags to your code sample and, now, so has one of the moderators.
Unless you repond to the request(s), you will be in breach of the forum rules ... and so will I be if I respond to your post.
Please follow the rules and we can investigate further.
Regards
Hope make it right.
Regards
Sub Actualizar() ActiveWorkbook.RefreshAll Call Botão9_Click End Sub Sub Botão9_Click() Sheets("ANÁLISE").Select Range("B1:S74").Select Range("B2").Activate ActiveWorkbook.RefreshAll Call Configurar End Sub Sub Configurar() Sheets("DETALHE").Select Cells.Replace What:="JOÃO ROLDÃO", Replacement:="JOAO ROLDAO", LookAt:= _ xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Sheets("ANÁLISE").Select Sheets("VENDAS CL").Visible = True Sheets("VENDAS CL").Select Range("A44").Select Cells.Replace What:="ELETTROCANALLI", Replacement:="ELETTROCANALI", LookAt _ :=xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False _ , ReplaceFormat:=False Cells.Replace What:="ITW", Replacement:="ITW(ELEMATIC)", LookAt:=xlWhole _ , SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Cells.Replace What:="TARGETTI", Replacement:="TARGETTI(ESEDRA)", LookAt:= _ xlWhole, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Range("A48").Select Selection.ClearContents Range("A47").Select Selection.ClearContents Range("A45").Select Selection.ClearContents Range("A47").Select ActiveCell.FormulaR1C1 = "CABOS ESPECIAIS" Range("A48").Select Sheets("VENDAS CL").Select ActiveWindow.SelectedSheets.Visible = False Sheets("ANÁLISE").Select Range("A1:A2").Select End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks