Hi
I was able to get help from another forum member for this code. It gets ranges from different worksheets and specific cells and brings them back to one master worksheet. I was wondering how to modify the code so that the ranges come back to the master sheet as paste special as values. Here is the code so far
Sub PullData()
Dim ws As Worksheet: Set ws = Sheets("Master")
Dim wksht As Worksheet
Dim lMasterLR As Long, lwkshtLR1 As Long, lwkshtLR2 As Long
Dim strAccount As String
On Error GoTo ErrHandler
Application.ScreenUpdating = False
For Each wksht In Worksheets
If wksht.Name <> "Master" Then
lMasterLR = ws.Range("B" & Rows.Count).End(xlUp).Row
strAccount = wksht.Range("C8").Value
If wksht.Range("B23").Value <> "" Then
lwkshtLR1 = wksht.Range("B" & Rows.Count).End(xlUp).Row
wksht.Range("B23:B" & lwkshtLR1).Copy Destination:=ws.Range("B" & lMasterLR).Offset(1, 0)
ws.Range("C" & lMasterLR + 1).Value = strAccount
ws.Range("C" & lMasterLR + 1, "D" & ws.Range("B" & Rows.Count).End(xlUp).Row).FillDown
End If
If wksht.Range("F23").Value <> "" Then
lwkshtLR2 = wksht.Range("F" & Rows.Count).End(xlUp).Row
wksht.Range("F23:F" & lwkshtLR2).Copy Destination:=ws.Range("I" & lMasterLR).Offset(1, 0)
End If
End If
Next wksht
Application.ScreenUpdating = True
Debug.Print "Procedure Completed Successfully"
Exit Sub
ErrHandler:
Debug.Print "There has been a critical error."
Application.ScreenUpdating = True
End Sub
Bookmarks