Excel VBA can Loop Other Workbook ?

nanuutm

New Member
Joined
Mar 16, 2016
Messages
27
Hi all

Now I have 2 File
-VBA_CONTROL_FCO_NEW
-FCO_NEW


[VBA_CONTROL_FCO_NEW]
Run Macro
open loop
Open [FCO_NEW] file
[FCO_NEW] run macro and save as (Change File name) and Close
end loop

Code:
Sub Macro2()Dim i As Integer
For i = 1 To 6
Workbooks.Open ("C:\Users\THJunsomPa\Desktop\VBAEXCEL\FCO_NEW.xlsm")
Windows("VBA_CONTROL_FCO_New.xlsm").Activate
    Range("J2") = Range("A" & i + 1).Value
    MsgBox Range("J2")
    Range("J3") = Range("B" & i + 1).Value
    MsgBox Range("J3")
    Call Macro1
    Call Marcodd
    MsgBox i
    
Next i
End Sub

Sub Marcodd()
Application.Run "'" & "C:\Users\THJunsomPa\Desktop\VBAEXCEL\FCO_NEW.xlsm" & "'!B_Clear"
End Sub


012501.png



File FCO_NEW <<< Run Macro BClear>>> change file name >> Save as >> Close

012502.png



My Problem is when file [FCO_NEW] run [B_Clear] end it must be loop in [VBA_CONTROL_FCO_NEW] File

Thank you all

Sorry about my english

 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,530
Messages
6,125,353
Members
449,220
Latest member
Edwin_SVRZ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top