Extracting data and not formulas when using VBA

shakeregg

New Member
Joined
Sep 2, 2018
Messages
39
Hey all,

Mumps kindly provided the below which enabled me to extract information to a Worksheet called 'Raw Data' from various sources which contained a worksheet named Sheet1. I've developed the sources worksheets in that the cells where the information is pulled through from now contain basic formulas which produces the text.

Is there a way of pulling through the data and not the formula to the Worksheet "Raw Data"..................... any help will be really appreciated!

Sub CopyRange()
Application.ScreenUpdating = False
Dim wkbSource As Workbook, wsDest As Worksheet
Set wsDest = ThisWorkbook.Sheets("Raw Data")
Dim lColumn As Long
lColumn = 2
Const strPath As String = "C:\Users\Laura\OneDrive\Documents\Database"
ChDir strPath
strextension = Dir(strPath & "*.xlsm")
Do While strextension <> ""
If strextension <> ThisWorkbook.Name Then
Set wkbSource = Workbooks.Open(strPath & strextension)
With wkbSource
.Sheets("Sheet1").Range("A4:A52").Copy wsDest.Cells(4, lColumn)
lColumn = lColumn + 1
.Close savechanges:=False
End With
End If
strextension = Dir
Loop
Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
Code:
With wkbSource
   wsDest.Cells(4, lColumn).Resize(49).Value = .Sheets("Sheet1").Range("A4:A52").Value
   lColumn = lColumn + 1
   .Close savechanges:=False
End With
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top