L
leveleyed
So far, I was able to make a macro to filter data from a project log sheet in
a workbook, and copy/paste the rest of the data in each row based on criteria
in column A to the corresponding worksheets with a name matching the data in
column A on the project log. But now what I need to do is make a macro that
will do basically the same thing, but will instead run on sheet(1) of any
other workbooks with a filename that contains "RetailProjectLog" in a certain
folder location on a network share. Is this possible? If so, how can I do it?
I wish I could attach my sample workbook so you could see an example of what
I'm talking about. If there is some way to attach an example workbook please
let me know and I will do so. Here is the macro I am using now though.
Sub Test()
Dim Cell As Range, x As Integer, LastRow As Long
Application.ScreenUpdating = False
For x = 2 To Worksheets.Count
Sheets(x).Range("A12").Value = Sheets(x).Range("A12")
For Each Cell In Sheets(1).Range("A3:A250")
' Find Last Row num for each sheet
With Sheets(x).Range("A:A")
LastRow = .Cells(.Count, 1).End(xlUp).Row + 1
End With
If Cell.Value = Sheets(x).Name Then
Cell.Offset(0, 1).Resize(, 16).Copy
Sheets(x).Range("A" & LastRow).PasteSpecial (xlPasteValues)
Cell.Offset(0, 17).Copy
Sheets(x).Range("A" & LastRow).Offset(0, 24).PasteSpecial
(xlPasteValues)
End If
Next Cell
Next x
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Thank you for any help you can offer!
Mike
a workbook, and copy/paste the rest of the data in each row based on criteria
in column A to the corresponding worksheets with a name matching the data in
column A on the project log. But now what I need to do is make a macro that
will do basically the same thing, but will instead run on sheet(1) of any
other workbooks with a filename that contains "RetailProjectLog" in a certain
folder location on a network share. Is this possible? If so, how can I do it?
I wish I could attach my sample workbook so you could see an example of what
I'm talking about. If there is some way to attach an example workbook please
let me know and I will do so. Here is the macro I am using now though.
Sub Test()
Dim Cell As Range, x As Integer, LastRow As Long
Application.ScreenUpdating = False
For x = 2 To Worksheets.Count
Sheets(x).Range("A12").Value = Sheets(x).Range("A12")
For Each Cell In Sheets(1).Range("A3:A250")
' Find Last Row num for each sheet
With Sheets(x).Range("A:A")
LastRow = .Cells(.Count, 1).End(xlUp).Row + 1
End With
If Cell.Value = Sheets(x).Name Then
Cell.Offset(0, 1).Resize(, 16).Copy
Sheets(x).Range("A" & LastRow).PasteSpecial (xlPasteValues)
Cell.Offset(0, 17).Copy
Sheets(x).Range("A" & LastRow).Offset(0, 24).PasteSpecial
(xlPasteValues)
End If
Next Cell
Next x
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Thank you for any help you can offer!
Mike