Hi guys, I'm new to your boards and pretty new to VBA. But I have found a lot of useful information from this site in the past and now I need your help!!
I am using VBA to get data from a series of closed workbooks. My code works perfectly for one value, but I need a range of values. Can I please get advice on how to extend my range?
Background:
Each of the closed files have identical layout
Column A is labels
Title is in B2
Data is in B3:B17
The master file ("VBA test"):
Row 1 is labels
Column A is unique identifier for each file
Row 2, 3, 4 etc. is where I want data (transposed from original set)
Does that make sense???
please let me know If i can give you any further information.
(sadly I am at work and cannot upload files.)
Here is my code so far for the first value in each file. What i need is all 15 values from each file across each row.
Your help is MUCH appreciated!!!!
Sub test2()
Dim WBN As Workbook
Dim WS2 As Worksheet
Dim FP As String
Dim FN As String
Application.ScreenUpdating = False
Set WBN = Workbooks("VBA test.xlsm")
Set WS2 = WBN.Worksheets("Sheet2")
FP = ActiveWorkbook.path & Application.PathSeparator
FN = Dir(FP & "*.xlsx")
Range("B2").Select
Do While Len(FN) > 0
Workbooks.Open Filename:=FP & FN
Bob = Worksheets("Sheet1").Range("B3")
ActiveWorkbook.Close SaveChanges:=False
ActiveCell.Value = Bob
ActiveCell.Offset(1, 0).Select
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub
Bookmarks