Sub Rar_UnRar() Dim RetVal Dim c As Range Dim WinRarApp$, adr$ WinRarApp$ = Chr(34) & "C:\Program Files\WinRAR\WinRAR.exe" & Chr(34) & " e " & " -o+ " For Each c In Range(Cells(UsedRange.Row, 3), Cells(UsedRange.Rows.Count, 3)) If c <> "" Then adr$ = WinRarApp$ & Chr(34) & c & Chr(34) & " " & Chr(34) & c & Chr(34) RetVal = Shell(adr$, vbHide) 'vbNormalFocus) End If Next End Sub
[/vba]
[vba]
Код
Sub Rar_UnRar() Dim RetVal Dim c As Range Dim WinRarApp$, adr$ WinRarApp$ = Chr(34) & "C:\Program Files\WinRAR\WinRAR.exe" & Chr(34) & " e " & " -o+ " For Each c In Range(Cells(UsedRange.Row, 3), Cells(UsedRange.Rows.Count, 3)) If c <> "" Then adr$ = WinRarApp$ & Chr(34) & c & Chr(34) & " " & Chr(34) & c & Chr(34) RetVal = Shell(adr$, vbHide) 'vbNormalFocus) End If Next End Sub
С учетом того, что есть в вашем документе, логично делать так: [vba]
Код
Sub Rar_UnRar1() Dim RetVal Dim WinRarApp$, adr$, i% WinRarApp$ = Chr(34) & "C:\Program Files\WinRAR\WinRAR.exe" & Chr(34) & " e " & " -o+ " For i = 2 To Range("c65536").End(xlUp).Row If Cells(i, 3).Value <> "" And Cells(i, 4).Value <> "" Then adr$ = WinRarApp$ & Chr(34) & Cells(i, 3).Value & Chr(34) & " " & Chr(34) & Cells(i, 4).Value & Chr(34) RetVal = Shell(adr$, vbHide) 'vbNormalFocus) End If Next i End Sub
[/vba]
С учетом того, что есть в вашем документе, логично делать так: [vba]
Код
Sub Rar_UnRar1() Dim RetVal Dim WinRarApp$, adr$, i% WinRarApp$ = Chr(34) & "C:\Program Files\WinRAR\WinRAR.exe" & Chr(34) & " e " & " -o+ " For i = 2 To Range("c65536").End(xlUp).Row If Cells(i, 3).Value <> "" And Cells(i, 4).Value <> "" Then adr$ = WinRarApp$ & Chr(34) & Cells(i, 3).Value & Chr(34) & " " & Chr(34) & Cells(i, 4).Value & Chr(34) RetVal = Shell(adr$, vbHide) 'vbNormalFocus) End If Next i End Sub