Hello
I'm pretty experienced with Excel (2003) but am a bit of an amateur when it comes to macros and VBA. I have part of an existing macro that someone created for me that I would like to edit:
The purpose of this macro is it extracts data from all individual workbooks within the same folder and merge it into one separate/master worksheet. The problem is that when it extracts from one of the workbooks, it contains VLOOKUP formulae and significantly slows down the whole process as a result.
Is there a way I can amend the above code such that rather than extract/copy and paste all data as it is (and therefore formulae as it is) but have it paste values instead?
I hope the above is clear. I would be most grateful for any assistance or guidance offered.
Many thanks
I'm pretty experienced with Excel (2003) but am a bit of an amateur when it comes to macros and VBA. I have part of an existing macro that someone created for me that I would like to edit:
Code:
Application.StatusBar = "Cycling over files..."
For Each loFile In loFSO.GetFolder(ThisWorkbook.Path).Files
If LCase(Right(loFile.Path, 3)) = "xls" And loFile.Name <> ThisWorkbook.Name Then
Set loWorkbook = Workbooks.Open(loFile.Path, ReadOnly:=True)
For Each loWorksheet In loWorkbook.Worksheets
If InStr(1, mcsExcludedSheets, loWorksheet.Name, vbTextCompare) = 0 Then 'if not excluded
Application.StatusBar = "Extracting Data from " & loWorkbook.Name & ": " & loWorksheet.Name
'Select range to search
Set loSource = loWorksheet.Range(mcsAlwaysPresentStart)
loWorksheet.AutoFilterMode = False
llCount = loWorksheet.Range("A65000").End(xlUp).Row
For i = 1 To llCount
If loSource.Text <> "" Then
If pbAll Or loSource.Offset(0, mclSometimesMissingColumnOffset).Text = "" Then
loSource.Worksheet.Range(loSource.Worksheet.Cells(loSource.Row, 1), loSource.Worksheet.Cells(loSource.Row, llColumns)).Copy loTarget
'loSource.Worksheet.Rows(loSource.Row).Copy loTarget
'loTarget.Offset(0, 10).Value = "'" & loTarget.Offset(0, 10).Value
Set loTarget = loTarget.Offset(1, 0)
End If
End If
Set loSource = loSource.Offset(1, 0)
Next i
End If
Next loWorksheet
loWorkbook.Close False
End If
Next loFile
Is there a way I can amend the above code such that rather than extract/copy and paste all data as it is (and therefore formulae as it is) but have it paste values instead?
I hope the above is clear. I would be most grateful for any assistance or guidance offered.
Many thanks