Sub Unzip_files()
' print values in I coulmn
Sheets("Download_PRdata1").Range("I1").Value = "SET PATH=%PATH%;C:\Users\hp\Documents\test"
Sheets("Download_PRdata1").Range("I2").Select
ActiveCell.FormulaR1C1 = _
"for /R ""C:\Users\hp\Documents\test"" %%I in (""*.zip"") do (""C:\Program Files\7-Zip\7z.exe"" X -y -o""%%~dpI"" ""%%~fI"")"
Sheets("Download_PRdata1").Range("I3").Select
ActiveCell.FormulaR1C1 = _
"for /R ""C:\Users\hp\Documents\test"" %%I in (""*.7z"") do (""C:\Program Files\7-Zip\7z.exe"" X -y -o""%%~dpI"" ""%%~fI"")"
Sheets("Download_PRdata1").Range("I4").Select
ActiveCell.FormulaR1C1 = _
"for /R ""C:\Users\hp\Documents\test"" %%I in (""*.7z_encrpt"") do (""C:\Program Files\7-Zip\7z.exe"" X -y -o""%%~dpI"" ""%%~fI"")"
Sheets("Download_PRdata1").Range("I5").Select
ActiveCell.FormulaR1C1 = _
"del /s ""C:\Users\hp\Documents\test\*.zip"""
Sheets("Download_PRdata1").Range("I6").Select
ActiveCell.FormulaR1C1 = _
"del /s ""C:\Users\hp\Documents\test\*.7z"""
Sheets("Download_PRdata1").Range("I7").Select
ActiveCell.FormulaR1C1 = _
"del /s ""C:\Users\hp\Documents\test\*.7z_encrpt"""
' replace path with actual downloaded folder
Range("I1").Select
ActiveCell.FormulaR1C1 = "SET PATH=%PATH%;C:\Users\hp\Documents\test"
Range("E3").Select
Selection.Copy
Columns("I:I").Select
Selection.Replace What:="C:\Users\hp\Documents\test", Replacement:= _
"C:\Users\a3rgcw\Downloads", LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
Range("E3").Select
Application.CutCopyMode = False
'Print values from I coulmn in bat. file
' source: https://superuser.com/questions/1045707/create-bat-file-with-excel-data-with-vba
Dim ColumnNum: ColumnNum = 9 ' Column I
Dim RowNum: RowNum = 1 ' Row to start on
Dim objFSO, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("C:\Users\" & Environ("UserName") & "\Desktop\newcurl.bat") 'Output Path
Dim OutputString: OutputString = ""
Do
OutputString = OutputString & Replace(Cells(RowNum, ColumnNum).Value, Chr(10), vbNewLine) & vbNewLine
RowNum = RowNum + 1
Loop Until IsEmpty(Cells(RowNum, ColumnNum))
objFile.Write (OutputString)
Set objFile = Nothing
Set objFSO = Nothing
' run bat file
' source: http://stackoverflow.com/questions/37919707/run-bat-file-from-excel-using-vba
Shell "C:\Users\" & Environ("UserName") & "\Desktop\newcurl.bat", vbNormalFocus
DoEvents
End Sub