Copy cell values between Excel files without keystrokes

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Copy cell values between Excel files without keystrokes

22 Jan 2018, 13:49

I've tried to PM a couple guys here and commission them to code some tasks for me, but there has been some miscommunication, so i'll take a stab at trying to figure this out myself. I do appreciate the time and suggestions they offered if they're reading this. I used the search feature but still struggling to figure out how to assemble all this.

I'm running Windows 7 and Excel 2013, both 64bit. I need to copy text/values from one (temporarily opened) excel file to another (constantly open/active/maximized). One file (Temp) sits in an active/maximized folder at Windows taskbar #1 position. The other one (Perm) is active /maximized at Windows taskbar #2 position. I want the script to open the "Temp" file, copy text values from two specific worksheet (Sheet1) cells (A1, B1), and paste into "Perm" file specific worksheet (Sheet1) cells (A1, B1), and then delete the "Temp" file in folder at Windows taskbar #1 position. The Temp file is basically a product of Excel reports generated by third party software which always differ in file name and values. If I can direct AHK to open any existing (regardless of name) xlsx file in the Windows folder and delete, that would be great. I'm able to do this using keystrokes in AHK, but i'm looking to integrate a smoother (hopefully faster) COM type solution.
Last edited by hidefguy on 24 Jan 2018, 22:07, edited 3 times in total.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Copy cell values between Excel files without keystrokes

22 Jan 2018, 15:51

Here is a start:

Code: Select all

; Open new instance of Excel and show it
xlApp := ComObjCreate("Excel.Application")
xlApp.Visible := true

; Define the paths to two Excel files (used A_Desktop to point to the files on my computer but could use absolute paths)
FileFrom_Path := A_Desktop "\Test\Test1.xlsx"
FileTo_Path := A_Desktop "\Test\Test2.xlsx"

; Open two Excel files
FileFrom := xlApp.Workbooks.Open(FileFrom_Path)
FileTo := xlApp.Workbooks.Open(FileTo_Path)

; Make the value of the A2 cell on the second sheet of the "To" file equal to the value of the B3 cell on the first sheet of the "From" file 
FileTo.Sheets(2).Range("A2").value := FileFrom.Sheets(1).Range("B3").value
This will show you how to open two Excel files and copy a value from one cell to another.

Hopefully this will get you started. How you accomplish this now with keystrokes has no bearing and is not very useful in how you can do it with COM.

When asking for help, instead of showing how you do it now with keystrokes it would probably be more productive to just ask what you want moved from where, to where.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

22 Jan 2018, 15:57

Thanks again FG. I'll play around with it
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

22 Jan 2018, 23:53

Code: Select all

xlApp := ComObjActive("Excel.Application")
xlApp.Visible := true

FileFrom_Path := A_Desktop "\Folder\Temp.xlsx"
FileTo_Path := A_Desktop "\Perm.xlsx"

FileFrom := xlApp.Workbooks.Open(FileFrom_Path)
FileTo := xlApp.Workbooks.Open(FileTo_Path)

FileTo.Sheets(1).Range("A2").value := FileFrom.Sheets(2).Range("D4").value
FileTo.Sheets(1).Range("B2").value := FileFrom.Sheets(2).Range("I4").value
With the following script and Perm.xlsx active I've successfully copied and pasted the values between workbooks. Is there a way to access the xlsx file in the Folder without setting the \Folder\Temp.xlsx path by looking for just the file type? For example like \Folder\.xlsx.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Copy cell values between Excel files without keystrokes

23 Jan 2018, 13:28

hidefguy wrote:Is there a way to access the xlsx file in the Folder without setting the \Folder\Temp.xlsx path by looking for just the file type? For example like \Folder\.xlsx.
Here is an example of how to loop through all of a certain type files in a folder.

Code: Select all

FileFrom_Pattern := A_Desktop "\Test\*.xlsx"
Loop, Files, % FileFrom_Pattern
{
	MsgBox % A_LoopFileLongPath
}
This allows you to do something like this:

Code: Select all

xlApp := ComObjActive("Excel.Application")
xlApp.Visible := true

FileTo_Path := A_Desktop "\Perm.xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)

FileFrom_Pattern := A_Desktop "\Folder\*.xlsx"
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	FileTo.Sheets(1).Range("A1").OffSet(A_Index,0).value := FileFrom.Sheets(2).Range("D4").value
	FileTo.Sheets(1).Range("B1").OffSet(A_Index,0).value := FileFrom.Sheets(2).Range("I4").value
	FileFrom.Close()
}
This is untested but should open your Perm workbook, then open each xlsx file in the given folder and copy the values from D4 and I4 on the second sheet to the first sheet of your Perm workbook, offsetting the copy to cells one down each time.

The first files values into A2 & B2, then A3 & B3, then A4 & B4, etc.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

23 Jan 2018, 22:05

Code: Select all

xlApp := ComObjActive("Excel.Application")
xlApp.Visible := true

FileTo_Path := A_Desktop "\Perm.xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)

FileFrom_Pattern := A_Desktop "\Test\1.xlsx"
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	FileTo.Sheets(1).Range("G1").OffSet(A_Index,0).value := FileFrom.Sheets(2).Range("D4").value
	FileTo.Sheets(1).Range("H1").OffSet(A_Index,0).value := FileFrom.Sheets(2).Range("I4").value
        FileFrom.Close()
}

FileFrom_Pattern := A_Desktop "\Test\2.xlsx"
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	FileTo.Sheets(1).Range("I1").OffSet(A_Index,0).value := FileFrom.Sheets(2).Range("I4").value
        FileFrom.Close()
}

FileFrom_Pattern := A_Desktop "\Test\3.xlsx"
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	FileTo.Sheets(1).Range("J1").OffSet(A_Index,0).value := FileFrom.Sheets(2).Range("I4").value
        FileFrom.Close()
}

ExitApp
Looks like I'm breaking some ground here. I was able with this script to populate the data with desired pattern (horizontally along row). The first xlsx file in the Temp folder has two desired cell values (D4, I4). The subsequent/remaining (24 actually) xlsx files in Temp folder only have one desired cell value (I4). Not sure if I have other options besides running 22 more of these loops. Also since I'm constantly populating rows in the Perm file and saving it for my research, so the ranges will not remain constant, but the columns always are. I'm just populating the next row of blank cells. Instead of Range("G1"), Range("H1"),etc... can I do something like Column("G"), Column("H"), etc...? After all 25 iterations complete, I need to delete the 25 xlsx files in the Temp folder. Another 25 will be generated/saved through the third party software.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Copy cell values between Excel files without keystrokes

24 Jan 2018, 14:45

Code: Select all

xlApp := ComObjActive("Excel.Application") ; Excel must be running

FileTo_Path := A_Desktop "\Perm.xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)

FileFrom_Pattern := A_Desktop "\Test\*.xlsx"
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	if (A_Index = 1)
	{
		FileTo.Sheets(1).Range("G1").value := FileFrom.Sheets(2).Range("D4").value
		FileTo.Sheets(1).Range("H1").value := FileFrom.Sheets(2).Range("I4").value
	}
	else
	{
		FileTo.Sheets(1).Range("G1").OffSet(0,A_Index).value := FileFrom.Sheets(2).Range("I4").value
	}
	FileFromFullPath := FileFrom.Path "\" FileFrom.Name
	FileFrom.Close()
	FileDelete, % FileFromFullPath
}
This will open your Perm file and then all xlsx files in your Test folder one at a time. The first one copies values to the G1 and H1 cells. All the ones past the first are copied to a cell offset by an increasing amount to the right so you end up with data going into G1, H1, I1, J1, etc.

Each of the From files are deleted after data is copied from them.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

24 Jan 2018, 21:24

Sweet! I’ll play around with it. I feel guilty for wasting your time with the guidance you’ve provided. At least let me make a donation to your favorite charity :)

Before the ComObjActive copy script/loop even starts I’ve been using send, # to bring up the windows at lower tab. #1 is the software and #2 is open Perm excel file.

I tried this instead:

WinActivate, Software
WinActivate, Microsoft Excel

Software works fine, but Excel doesn’t come up. Should I just stick with keystrokes, or continue with a COM solution?
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Copy cell values between Excel files without keystrokes

24 Jan 2018, 23:27

hidefguy wrote:Sweet! I’ll play around with it. I feel guilty for wasting your time with the guidance you’ve provided. At least let me make a donation to your favorite charity :)

Before the ComObjActive copy script/loop even starts I’ve been using send, # to bring up the windows at lower tab. #1 is the software and #2 is open Perm excel file.

I tried this instead:

WinActivate, Software
WinActivate, Microsoft Excel

Software works fine, but Excel doesn’t come up. Should I just stick with keystrokes, or continue with a COM solution?
If you change ComObjActive to ComObjCreate there is no reason to open Excel outside the script. This will cause the script to create an instance of Excel.

By default a new instance of Excel is not displayed and everything happens in the background. This is a little faster.

If you want to actual see Excel opening the workbooks and doing stuff you can do this:

Code: Select all

xlApp := ComObjCreate("Excel.Application")
xlApp.Visible := true
This will create a new instance of Excel and cause it to be visible. But with the scripts above, it will probably look like just a bunch of flickering as it opens and closes lots of workbooks very quickly. But when it gets through it should still have the Perm file open. You will need to save that if it is to your liking. But again you could have COM save it for you automatically at the end.

Code: Select all

FileTo.Save()	; save workbook
xlApp.DisplayAlerts := false	; don't display overwrite warning if file already exist
xlApp.Quit()	; close this instance of Excel
You can also do a SaveAs if you wanted to save with new name.

COM does not care if Excel windows are visible, minimized, positioned, active, what they are named, any of that. COM can detect all that stuff if a script needs to know but none of that is important to make AHK work with Excel through COM. Most COM scripts never reference or need anything about an Excel window.

A donation is not necessary but if you feel inclined you can donate to the AutoHotkey Foundation at the link below.
https://autohotkey.com/foundation/
Near the bottom of the page is a link to donate through PayPal.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

25 Jan 2018, 01:43

FanaticGuru wrote:This will open your Perm file and then all xlsx files in your Test folder one at a time. The first one copies values to the G1 and H1 cells. All the ones past the first are copied to a cell offset by an increasing amount to the right so you end up with data going into G1, H1, I1, J1, etc.

Each of the From files are deleted after data is copied from them.

FG
That tested out well, and does specifically what I need. Can I substitute Range("G1"), Range("H1") to a function that references the first blank cell in column G, column H and so on? My Perm sheet will always have columns A-F pre-populated (manually) with values, before AHK automation is executed. The next G-H-I-etc... column blank cells can start on any given G row number. It's a constant continuation (day to day) and the Perm file is saved after completion of each AHK script.
FanaticGuru wrote: If you change ComObjActive to ComObjCreate there is no reason to open Excel outside the script. This will cause the script to create an instance of Excel.

By default a new instance of Excel is not displayed and everything happens in the background. This is a little faster.
I tried the ComObjCreate, and I see what you mean. That's pretty swift.

The assembled script will start/flow in some form of this, with software open at taskbar #1 window and Perm at taskbar #2 window. Except for the send, #, send, ^{ins} (copies Perm.xlsx column A value) keystrokes , the others are needed to manipulate the non-COM friendly software. I think the send, ^{V} (pastes Perm.xlsx column A value into software) might also be non-negotiable since it occurs within software. Be nice if I can convert the eligible keystrokes to COM capable commands. I can then just run the ComObjCreate with Excel in background, and let the software specific keystrokes do their thing.

send, #{1}
sleep, 500
send, {F6}
sleep, 500
send, {tab}
sleep, 500
send, {tab}
sleep, 500
send, #{2}
sleep, 500
send, ^{ins}
send, #{1}
sleep, 500
send, ^{V}
sleep, 500
send, ^!{enter}
sleep, 200
send, {enter}
sleep, 200
send, {esc}
sleep, 3000
send, {F8}
sleep, 1000
send, #{up}
sleep, 200
mouseclick, right
sleep, 200
send, {S}
sleep, 200
send, {enter}
sleep, 1000
send, {enter}
sleep, 1000
send, {enter}
sleep, 5000
send, !{F4}
sleep, 200
send, !{F4}
sleep, 200
send, #{2}
sleep, 200

xlApp := ComObjActive("Excel.Application")

FileTo_Path := A_Desktop "\Perm.xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)

FileFrom_Pattern := A_Desktop "\Test\*.xlsx"
Loop, Files, % FileFrom_Pattern
{
FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
if (A_Index = 1)
{
FileTo.Sheets(1).Range("G1").value := FileFrom.Sheets(2).Range("D4").value
FileTo.Sheets(1).Range("H1").value := FileFrom.Sheets(2).Range("I4").value
}
else
{
FileTo.Sheets(1).Range("G1").OffSet(0,A_Index).value := FileFrom.Sheets(2).Range("I4").value
}
FileFromFullPath := FileFrom.Path "\" FileFrom.Name
FileFrom.Close()
FileDelete, % FileFromFullPath
}

ExitApp
FanaticGuru wrote: FileFromFullPath := FileFrom.Path "\" FileFrom.Name
FileFrom.Close()
FileDelete, % FileFromFullPath
The AHK docs for FileDelete state that files get deleted from %A_WorkingDir%. Are they automatically wiped/ cleaned when I exit AHK, or is their some type of folder they build up in?
FanaticGuru wrote: A donation is not necessary but if you feel inclined you can donate to the AutoHotkey Foundation at the link below.
https://autohotkey.com/foundation/
Near the bottom of the page is a link to donate through PayPal.

FG
Definitely plan on making a sizable donation. Have made some huge strides in just two days with your help. Your commitment to this AHK community is beyond noble.
Last edited by hidefguy on 25 Jan 2018, 02:23, edited 1 time in total.
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

06 Mar 2018, 15:08

FanaticGuru wrote:

Code: Select all

xlApp := ComObjActive("Excel.Application") ; Excel must be running

FileTo_Path := A_Desktop "\Perm.xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)

FileFrom_Pattern := A_Desktop "\Test\*.xlsx"
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	if (A_Index = 1)
	{
		FileTo.Sheets(1).Range("G1").value := FileFrom.Sheets(2).Range("D4").value
		FileTo.Sheets(1).Range("H1").value := FileFrom.Sheets(2).Range("I4").value
	}
	else
	{
		FileTo.Sheets(1).Range("G1").OffSet(0,A_Index).value := FileFrom.Sheets(2).Range("I4").value
	}
	FileFromFullPath := FileFrom.Path "\" FileFrom.Name
	FileFrom.Close()
	FileDelete, % FileFromFullPath
}
This will open your Perm file and then all xlsx files in your Test folder one at a time. The first one copies values to the G1 and H1 cells. All the ones past the first are copied to a cell offset by an increasing amount to the right so you end up with data going into G1, H1, I1, J1, etc.

Each of the From files are deleted after data is copied from them.

FG
Hi again FG. I'm attempting the above scenario, but with additional column values, and after first file opens/completes, want only column values I4,I6,I8,I10,I12 from subsequent files to populate to the right, remaining row cells, five cells at a time. I tried this below, and changing around A_Index value, plus a few other things. First file opens/copies fine, but no luck with subsequent ones. Searched around here and confused myself.

Code: Select all

Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	if (A_Index = 1)
	{
	    FileTo.Sheets(1).Range("G1").value := FileFrom.Sheets(2).Range("D4").value
	    FileTo.Sheets(1).Range("H1").value := FileFrom.Sheets(2).Range("I4").value
        FileTo.Sheets(1).Range("I1").value := FileFrom.Sheets(2).Range("I6").value
        FileTo.Sheets(1).Range("J1").value := FileFrom.Sheets(2).Range("I8").value
        FileTo.Sheets(1).Range("K1").value := FileFrom.Sheets(2).Range("I10").value
        FileTo.Sheets(1).Range("L1").value := FileFrom.Sheets(2).Range("I12").value
	}
	else
	{
		FileTo.Sheets(1).Range("L1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I4:I12").value
	}
	FileFromFullPath := FileFrom.Path "\" FileFrom.Name
	FileFrom.Close()
    FileDelete, % FileFromFullPath
}
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Copy cell values between Excel files without keystrokes

06 Mar 2018, 17:47

FileTo.Sheets(1).Range("L1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I4:I12").value

In the above the Ranges are not the same size. The Ranges have to be the same size like below.

FileTo.Sheets(1).Range("L1:L9").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I4:I12").value

If you don't want the whole range then you are going to have to do it more manually.

Code: Select all

FileTo.Sheets(1).Range("L1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I4").value
FileTo.Sheets(1).Range("L2").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I6").value
FileTo.Sheets(1).Range("L3").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I8").value
FileTo.Sheets(1).Range("L4").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I10").value
FileTo.Sheets(1).Range("L5").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I12").value
You could do another loop here with some math to replace those 5 lines with 2 lines but probably not worth the trouble.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

06 Mar 2018, 18:56

Thanks for the tips. The FileFrom columnar values of I4-I12 I actually want populated horizontally in a row with same pattern as first file like so from second file:

FileTo.Sheets(1).Range("M1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I4").value
FileTo.Sheets(1).Range("N1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I6").value
FileTo.Sheets(1).Range("O1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I8").value
FileTo.Sheets(1).Range("P1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I10").value
FileTo.Sheets(1).Range("Q1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I12").value

and third file like so
FileTo.Sheets(1).Range("R1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I4").value
FileTo.Sheets(1).Range("S1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I6").value
FileTo.Sheets(1).Range("T1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I8").value
FileTo.Sheets(1).Range("U1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I10").value
FileTo.Sheets(1).Range("V1").Offset(0,A_Index).value := FileFrom.Sheets(2).Range("I12").value

and so on for remaining files.......
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Copy cell values between Excel files without keystrokes

06 Mar 2018, 20:29

Maybe this will work for you.

Code: Select all

Col := 5 ; starting column
Loop, Files, % FileFrom_Pattern
{
	FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
	if (A_Index = 1)
	{
		FileTo.Sheets(1).Cells(1,Col).value := FileFrom.Sheets(2).Range("D4").value
		Col++
	}
	for index, Address in ["I4","I6","I8","I10","I12"]
	{
		FileTo.Sheets(1).Cells(1,Col).value := FileFrom.Sheets(2).Range(Address).value
		Col++
	}
	FileFromFullPath := FileFrom.Path "\" FileFrom.Name
	FileFrom.Close()
    FileDelete, % FileFromFullPath
}
Untested.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
hidefguy
Posts: 57
Joined: 11 Apr 2017, 20:42

Re: Copy cell values between Excel files without keystrokes

06 Mar 2018, 21:45

Dude, you're the best. That worked perfectly. I should have been more precise in my initial post today. I posted a generic example that flows with your past sample code, but I was able to modify your code above. The script I run actually has an input for a starting row (@) followed by offsets, so I just did this, and followed down along the columns using snippets of this attaching the offsets:

Col := 5
Loop, Files, % FileFrom_Pattern
{
FileFrom := xlApp.Workbooks.Open(A_LoopFileFullPath)
if (A_Index = 1)
{
FileTo.Sheets(1).Cells(@,Col).value := FileFrom.Sheets(2).Range("D4").value
Col++
}
for index, Address in ["I4","I6","I8","I10","I12"]
{
FileTo.Sheets(1).Cells(@,Col).value := FileFrom.Sheets(2).Range(Address).value
Col++
}
FileFromFullPath := FileFrom.Path "\" FileFrom.Name
FileFrom.Close()
FileDelete, % FileFromFullPath
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 136 guests