ajdinspector
New Member
- Joined
- Nov 5, 2018
- Messages
- 8
Hello, HELP!
I am trying to write a vba script to copy three values from 375 worksheets and paste into another worksheet. All the 375 worksheets are in the same format, on each worksheet i need
cell "G3" copied to Sheet12 cell "A4" ,
cell "C50" copied to Sheet12 cell "B4",
cell "G50" copied to Sheet12 cell "D4",
cell "I50" copied to Sheet12 cell "F4"
then move to next sheet and
cell "G3" copied to Sheet12 cell "A5" ,
cell "C50" copied to Sheet12 cell "B5",
cell "G50" copied to Sheet12 cell "D5",
cell "I50" copied to Sheet12 cell "F5"
This is what i have, but it's not working
Sub CopyDFs()
Dim wb As Workbook
Dim ws As Range
Dim co As Range
Dim df1 As Range
Dim df2 As Range
Dim df3 As Range
Dim copyco As Range
Dim copydf1 As Range
Dim copydf2 As Range
Dim copydf3 As Range
Set wb = ThisWorkbook
Set ws = wb.Sheets(13): Sheets.Count
Set co = Worksheets(12).Range("A" & Rows.Count).End(xlUp).Offset(4, 0)
Set df1 = Worksheets(12).Range("B" & Rows.Count).End(xlUp).Offset(4, 0)
Set df2 = Worksheets(12).Range("D" & Rows.Count).End(xlUp).Offset(4, 0)
Set df3 = Worksheets(12).Range("F" & Rows.Count).End(xlUp).Offset(4, 0)
Set copyco = Range("G3")
Set copydf1 = Range("C50")
Set copydf2 = Range("G50")
Set copydf3 = Range("I50")
For Each ws In ActiveWorkbook.Worksheets
copyco.Copy
co.PasteSpecial xlPasteValues
copydf1.Copy
copydf1.PasteSpecial xlPasteValues
copydf2.Copy
copydf2.PasteSpecial xlPasteValues
copydf3.Copy
copydf3.PasteSpecial xlPasteValues
Next ws
End Sub
Thanks so much for the help
I am trying to write a vba script to copy three values from 375 worksheets and paste into another worksheet. All the 375 worksheets are in the same format, on each worksheet i need
cell "G3" copied to Sheet12 cell "A4" ,
cell "C50" copied to Sheet12 cell "B4",
cell "G50" copied to Sheet12 cell "D4",
cell "I50" copied to Sheet12 cell "F4"
then move to next sheet and
cell "G3" copied to Sheet12 cell "A5" ,
cell "C50" copied to Sheet12 cell "B5",
cell "G50" copied to Sheet12 cell "D5",
cell "I50" copied to Sheet12 cell "F5"
This is what i have, but it's not working
Sub CopyDFs()
Dim wb As Workbook
Dim ws As Range
Dim co As Range
Dim df1 As Range
Dim df2 As Range
Dim df3 As Range
Dim copyco As Range
Dim copydf1 As Range
Dim copydf2 As Range
Dim copydf3 As Range
Set wb = ThisWorkbook
Set ws = wb.Sheets(13): Sheets.Count
Set co = Worksheets(12).Range("A" & Rows.Count).End(xlUp).Offset(4, 0)
Set df1 = Worksheets(12).Range("B" & Rows.Count).End(xlUp).Offset(4, 0)
Set df2 = Worksheets(12).Range("D" & Rows.Count).End(xlUp).Offset(4, 0)
Set df3 = Worksheets(12).Range("F" & Rows.Count).End(xlUp).Offset(4, 0)
Set copyco = Range("G3")
Set copydf1 = Range("C50")
Set copydf2 = Range("G50")
Set copydf3 = Range("I50")
For Each ws In ActiveWorkbook.Worksheets
copyco.Copy
co.PasteSpecial xlPasteValues
copydf1.Copy
copydf1.PasteSpecial xlPasteValues
copydf2.Copy
copydf2.PasteSpecial xlPasteValues
copydf3.Copy
copydf3.PasteSpecial xlPasteValues
Next ws
End Sub
Thanks so much for the help