Em nhờ anh chị giup code này, bị sai mà em biết sữa.
Sub action()
Dim i as integer, j as integer, z as string, y as string, x as string
j=4
Rang(“E3”).select
For i =1 to j
z= sheet1.cells(sheet1.range(“E3”).row+i-1,”E”) ‘Full path, vd C:\minh\vd\... theo tung dong i
y=sheet1.cells(sheet1.range(“F3”).row+i-1,”F”) ‘ten file theo tung dong i
x=sheet1.cells(sheet1.range(“G3”).row+i-1,”G”) ‘ ten sub de action tung file theo tung dong i
Workbooks.open (z)
Call x ‘ cai nay bị lỗi error em tim chua ra, a chị giúp
‘ action sub co ten thong qua bien x
‘ vd neu i la 1, x nhan gia tri la B
‘ neu i la 2, x nhan gtri la C
‘ i la 3 thi x la L
‘ i la 4 thi x la N
Workbooks(y). close
Next
End sub
Sub B()
Msgbox “ thuc cac viec sau”
‘Achi add code giup em: copy sheet 2 vung A1:C11 den sheet3 cua file chinh chua code nay.
End sub
Sub C()
Msgbox “ok”
End sub
Sub L()
Msgbox “ok”
End sub
Sub N()
Msgbox “ok”
End sub
Sub action()
Dim i as integer, j as integer, z as string, y as string, x as string
j=4
Rang(“E3”).select
For i =1 to j
z= sheet1.cells(sheet1.range(“E3”).row+i-1,”E”) ‘Full path, vd C:\minh\vd\... theo tung dong i
y=sheet1.cells(sheet1.range(“F3”).row+i-1,”F”) ‘ten file theo tung dong i
x=sheet1.cells(sheet1.range(“G3”).row+i-1,”G”) ‘ ten sub de action tung file theo tung dong i
Workbooks.open (z)
Call x ‘ cai nay bị lỗi error em tim chua ra, a chị giúp
‘ action sub co ten thong qua bien x
‘ vd neu i la 1, x nhan gia tri la B
‘ neu i la 2, x nhan gtri la C
‘ i la 3 thi x la L
‘ i la 4 thi x la N
Workbooks(y). close
Next
End sub
Sub B()
Msgbox “ thuc cac viec sau”
‘Achi add code giup em: copy sheet 2 vung A1:C11 den sheet3 cua file chinh chua code nay.
End sub
Sub C()
Msgbox “ok”
End sub
Sub L()
Msgbox “ok”
End sub
Sub N()
Msgbox “ok”
End sub