I have a base spreadsheet that needs to gather data from many other spreadsheets (trials). Am trying to write a macro that accomplishes the following:
1) Prompt open file (different file used for each macro instance)
2) Copy column 1 from trial to a specific column in sheet 1 on base spreadsheet
3) Copy column 2 from trial to a specific column in sheet 2 on base spreadsheet, and so on..
4) While for each file the column that is being copied to is different (ie, trial 1 might be copied to Y2:Y102, trial 3 might be A2:A102), it will be the same range in each sheet
So what I want from the macro is for it to prompt me once for the range for one sheet, then continue to copy the columns into the same range but in different sheets without prompting.
Here is what I have so far:
Sub skymacroT1()
TrialFile = Application.GetOpenFilename
Workbooks.Open TrialFile
Range("B4:B104").Select
Selection.Copy
'
Windows("Sky Braced Pressure Combined.xlsm").Activate
Sheets("Lt Heel").Select
Dim MyRange As Range
Set MyRange = Application.InputBox("select cell", Type:=8)
MyRange.Select
Range("MyRange").Paste
Application.CutCopyMode = False
'
Windows("TrialFile").Activate
Range("C4:C104").Select
Selection.Copy
'
Windows("Sky Braced Pressure Combined.xlsm").Activate
Sheets("Lt Met").Select
MyRange.Select
Range("MyRange").PasteSpecial
Application.CutCopyMode = False
End Sub
However the code fails in two spots: Range("MyRange").Paste
fails to paste and Windows("TrialFile").Activate
doesn't open the window for the file I prompted for.
Any help would be greatly appreciated!!