I've made a VBA for a button in Excel for Mac that is supposed to copy the content of a few selected cells on one tab and paste it (as values) on the first available cell in an assigned row on a different tab.
This is the first time I've ever had a go at making this, so I probably didn't do it as efficient as possible, but it works.
The problem is that it only works on Mac. My co-workers that I've made it for uses PC. Can I convert the code to work on Excel for PC?
Edit: I should have been more explicit into what the problem actually is (thanks #KenWhite).
So here's what happened:
I created the file and the VBA.
I saved my file and attatched it to an email
my co-worker saved it and opened it up
When she pressed the button she got an error "Indexet är utanför intervall". My best translation for this is Index out of Range (but I'm not completely sure)
I suspected that it had to do with Mac -> PC, but some have pointed out that there should be no difference. I realize that the named on the sheets and that the data needs to be in the exact same spot - but that shouldn't be an issue in this case.
Edit 2: It seems to be a problem with special characters. the "ä" and "ö" used in the sheet names where changed in to "š" and "¨" in the VBA code on their end. I can't test it right now, but my guess is that the code will work if I either manually change the characters in the code or make sure to use sheet names without special characters.
If I should/could add additional information, let me know and I'll make another edit.
Thank you everyone.
Sub Generera()
'
' Generera Makro
'
'
Range("B1").Select
Selection.Copy
Sheets("Utveckling över tid").Select
BMaxRows = Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & BMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
CMaxRows = Cells(Rows.Count, "C").End(xlUp).Row
Range("C" & CMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
DMaxRows = Cells(Rows.Count, "D").End(xlUp).Row
Range("D" & DMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
EMaxRows = Cells(Rows.Count, "E").End(xlUp).Row
Range("E" & EMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
FMaxRows = Cells(Rows.Count, "F").End(xlUp).Row
Range("F" & FMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
GMaxRows = Cells(Rows.Count, "G").End(xlUp).Row
Range("G" & GMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
HMaxRows = Cells(Rows.Count, "H").End(xlUp).Row
Range("H" & HMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("veckoräckvidd").Select
Range("B11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
IMaxRows = Cells(Rows.Count, "I").End(xlUp).Row
Range("I" & IMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("veckoräckvidd").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Utveckling över tid").Select
JMaxRows = Cells(Rows.Count, "J").End(xlUp).Row
Range("J" & JMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I believe this is a replacement for your current macro, so this might solve your problem.
Sub Generera()
Dim ws1 As Worksheet
Set ws1 = sheets("Utveckling över tid")
Dim ws2 As Worksheet
Set ws2 = sheets("veckoräckvidd")
Dim i As Long
For i = 2 To 10
Dim colLetter As String
colLetter = Split(Cells(1, i).Address, "$")(1)
ws1.Range(colLetter & ws1.Cells(rows.count, colLetter).End(xlUp).row + 1).value = ws2.Range("B" & i - 1).value
Next i
End Sub
Here are the steps I took to convert your original code to my shorter version:
Range("B1").Select
Selection.copy
sheets("Utveckling över tid").Select
BMaxRows = Cells(rows.count, "B").End(xlUp).row
Range("B" & BMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Stopped using .Select, and started using direct Range().value transferring instead of .copy and .pastespecial so that I dont have to juggle cutcopymode and because you're not doing anything special, just copying the values only.
BMaxRows = sheets("veckoräckvidd").Cells(rows.count, "B").End(xlUp).row
sheets("veckoräckvidd").Range("B" & BMaxRows + 1).value = _
sheets("Utveckling över tid").Range("B1").value
Include the statement for BMaxRows inside of the range itself for eventual simplicity.
sheets("veckoräckvidd").Range("B" & sheets("veckoräckvidd").Cells(rows.count, "B").End(xlUp).row + 1).value = _
sheets("Utveckling över tid").Range("B1").value
Use Worksheet variables to shorten every time that I need to refer to one of the sheet names.
ws2.Range("B" & ws2.Cells(rows.count, "B").End(xlUp).row + 1).value = _
ws1.Range("B1").value
And to convert it to a loop you can compare a couple of the converted operations side by side to see what changes every instance. In this case it's the column letter for ws2 and the row number in ws1.
ws2.Range("B" & ws2.Cells(rows.count, "B").End(xlUp).row + 1).value = ws1.Range("B1").value
ws2.Range("C" & ws2.Cells(rows.count, "C").End(xlUp).row + 1).value = ws1.Range("B2").value
ws2.Range("D" & ws2.Cells(rows.count, "D").End(xlUp).row + 1).value = ws1.Range("B3").value
Related
I'm setting up a pricing model and am wondering how I am able to get the macro to run the pricing loan by loan and have the output pasted in a separate tab (this would also be loan by loan, so it cannot overwrite). I used the macro recorder and this is what I have so far, but I'm a novice and not sure how to loop this until it hits a blank cell (I did the first two loans....)
Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Copy
Sheets("Cashflows").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Output").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Input").Select
Range("A3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Cashflows").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Output").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
The tools you need:
To figure out the last row:
Dim LastRow As Integer
LastRow = Range("A" & Rows.Count).End(xlUp).Row
'This simulates selecting the last cell in "A" Column,
'hitting "End" and "Up Arrow", then returns that row number
'as in integer.
To cycle through each row:
Dim I As Integer
For I = 1 To 10 '(Or replace "10" with "LastRow")
'Do something like look at a range value:
Debug.Print Cells(I, 1).Value
Next I
Finally, this is going to be a lot easier if you use .value = .value instead of copying and pasting:
Dim RowNum As Integer
RowNum = 10
Range("A1").Value = Range("B1").Value 'Copies Value from B1 into A1
Cells(1, 1).Value = Range("B1").Value 'Does Exact same thing as above: Cells(row, column)
'Copy A10:C10 from sheet2 to sheet1:
Sheet1.Range("A" & RowNum & ":C" & RowNum).Value = Sheet2.Range("A" & RowNum & ":C" & RowNum)
See how far you get with that and come back if you have more specific questions.
There are lots of good resources out there if you're having trouble.
I am trying to record a macro that copies values from 4 cells then pastes them on another sheet that serves as a sort of log. I cannot get the values to paste in a new row though despite using the "Relative References" button when recording the macro. Is there something I can add to the code below to make the values paste in the next available row?
'''
Sub Again()
'
' Again Macro
'
'
Range("B5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Results").Select
ActiveCell.Offset(0, -3).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Test").Select
Range("C5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Results").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Test").Select
Range("D5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Results").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Test").Select
Range("E5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Results").Select
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
'''
Sub add_value()
Dim wbA As Workbook
Dim wsA As Worksheet
Set wbA = ActiveWorkbook
Set wsA = wbA.Worksheets("Sheet1")
Dim nrow As Long
nrow = 6
Do Until wsA.Range("B" & nrow).Value = ""
wsA.Range("B" & nrow).Value = wsA.Range("B3").Value
wsA.Range("C" & nrow).Value = wsA.Range("C3").Value
Exit Sub
nrow = nrow + 1
Loop
End Sub
This is actually working, now i just have to figure out how to offset it
I am writing VBA code in Excel to copy formulas from the last row of data to the row below it and then copying that last row (now second-to-last row) and paste as values in it's place. I would like to do this for multiple sheets. The problem is that after it works properly for the first sheet, it errors out on the next sheet (and presumably the rest of them).
The code works for the first worksheet but when it moves to the next sheet, Excel gives me a "Run-time error '1004': No cells were found" error message". When I debug the error, the 2nd line in the 3rd paragraph below is what gives me the problem. What do I have to do to allow this code to work for multiple worksheets in the same workbook?
Sheets("BrentSkew").Select
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree - 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("BrentSkew").Select
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree - 2).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree - 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
_
:=False, Transpose:=False
Sheets("LLSSkew").Select
'the line below is the problem
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree - 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("LLSSkew").Select
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree - 2).Select
Range(Selection, Selection.End(xlToRight)).Select
Application.CutCopyMode = False
Selection.Copy
NextFree = Range("A2:A" &
Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("A" & NextFree - 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
_
:=False, Transpose:=False
I am trying to run a macro that copy three tables from different worksheets and paste it together in a new worksheet.
The number of rows in the tables are not always the same. Therefore, I need a macro with a 'dynamic' "LastRow" parameter so that every time I update one single table the result of the macro is updated.
I tried to run this macro:^
Dim lastRow As Long
lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("Discussed Files").Select
Range("Table1[#Headers]").Select
Selection.Copy
Sheets("All data").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Discussed Files").Select
Range("Table1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("All data").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Files within 3 Days").Select
Range("Table3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("All data").Select
Range("A" & lastRow).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Files 10.04.17").Select
Range("Table5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("All data").Select
Range("A" & lastRow).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$Y$" & lastRow), , xlYes).Name = _
"Table14"
Range("Table14[#All]").Select
ActiveSheet.ListObjects("Table14").TableStyle = "TableStyleMedium2"
I cannot understand exactly what the macro is doing. It ends up woth a table having number of rows equal to first sheet but data inside the table are 'randomly' taken from the other sheets.
Moreover, the selection to make the result a table is not working properly.
As per comment above (have also removed unnecessary Selects)
Sub x()
Dim lastRow As Long
With Sheets("All data")
Sheets("Discussed Files").Range("Table1[#All]").Copy
.Range("A1").PasteSpecial Paste:=xlPasteValues
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Sheets("Files within 3 Days").Range("Table3").Copy
.Range("A" & lastRow).PasteSpecial Paste:=xlPasteValues
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Sheets("Files 10.04.17").Range("Table5").Copy
.Range("A" & lastRow).PasteSpecial Paste:=xlPasteValues
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.ListObjects.Add(xlSrcRange, .Range("$A$1:$Y$" & lastRow), , xlYes).Name = "Table14"
.ListObjects("Table14").TableStyle = "TableStyleMedium2"
End With
End Sub
You don't update lastRow between steps, so you are basically pasting them one over another into same spot because the lastRow does not update after you paste one of your tables, it retains the same value from the beginning of your code in each:
Range("A" & lastRow).Select
Selection.PasteSpecial
Also, this code will return last row with data in it so if you are pasting into clean sheet, you are pasting all tables into the same spot:
lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
EDIT:
Dim lastRow As Long
lastRow = Sheets("All data").Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("Discussed Files").Range("Table1[#All]").Select
Selection.Copy
Sheets("All data").Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
lastRow = Sheets("All data").Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("Files within 3 Days").Range("Table3").Select
Selection.Copy
Sheets("All data").Range("A" & lastRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
lastRow = Sheets("All data").Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("Files 10.04.17").Range("Table5").Select
Selection.Copy
Sheets("All data").Range("A" & lastRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
lastRow = Sheets("All data").Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("All data").ListObjects.Add(xlSrcRange, Range("$A$1:$Y$" & lastRow), , xlYes).Name = _
"Table14"
Range("Table14[#All]").Select
Sheets("All data").ListObjects("Table14").TableStyle = "TableStyleMedium2"
I have been tasked with extracting data out of an Excel sheet that is strangely/poorly formatted. There is far too much data to manually copy out, so I am trying to use a Macro. I am not very skilled with VBA, but I know a little (probably just enough to break something :) ).
I am just working on 1 sheet right now, but there are several sheets, all formatted in the same way. Here is a snippet of what the source data looks like:
I highlighted the cells that I am needing to copy. The rest of the data is not important and won't need to be extracted.
As you can see, the source data is not formatted as traditional rows and columns, to say the least.
I am copying this data into a table that I have set up in a new sheet.
****Edit:**** I updated my code. I realized that the data was formatted to where there are the same amount of spaces between the rows in the data that I need, 14 to be exact. I now have a Do While Loop that increments the Row Index by 14 each time to move to the next record.
This code works, but am I going about this the correct way??? I will need to repeat this process for about 50 sheets, some of which have 1000 or more records.
Sub CopyData()
Dim SourceSheet As Worksheet
Dim DestSheet As Worksheet
Dim DestRow As Long
Dim i As Integer
i = 0
Set SourceSheet = Sheets("Sheet1")
Set DestSheet = Sheets("Data")
Do While i < 100
DestRow = DestSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
SourceSheet.Cells(2 + i, 1).Copy
DestSheet.Range("A" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
SourceSheet.Cells(2 + i, 2).Copy
DestSheet.Range("D" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
SourceSheet.Cells(3 + i, 2).Copy
DestSheet.Range("E" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
SourceSheet.Cells(4 + i, 2).Copy
DestSheet.Range("F" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
SourceSheet.Cells(2 + i, 7).Copy
DestSheet.Range("C" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
SourceSheet.Cells(5 + i, 7).Copy
DestSheet.Range("G" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
SourceSheet.Cells(14 + i, 2).Copy
DestSheet.Range("B" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
i = i + 14
Loop
End Sub
Yes, I think what you are doing is good. You've figured out the pattern and how to increment through it. You probably want to add some kind of check for when you've reached the end of a sheet - the simplest would be to test for a blank in the first line after the Do and exit that loop with an Exit Do which will kick you into an outer loop like For each ws in wb.Worksheets.
This isn't a very technical answer I know, but it seems like you're very close and I didn't want to type all this in a comment.
I am posting the almost final code I came up with here in case it can help any one in the future. It turned out to not be quite as hard as I thought, once I discovered there was equal spacing in the data. Thanks #Doug Glancy for your advice on using Exit Do.
I am sure this is far from a perfect solution. Need to add some error handling/checking. I would appreciate any advice on ways that the code could be improved, or different ways to accomplish this.
Sub CopyData()
Dim DestSheet As Worksheet
Dim DestRow As Long
Dim i As Integer
Set DestSheet = Sheets("Data")
'Loop through all worksheets in the workbook
For Each Worksheet In ActiveWorkbook.Worksheets
'Reset counter variable for each worksheet
i = 0
'Check to make sure we are not on the destination sheet
If Worksheet.Name <> DestSheet.Name Then
'Loop through all rows in the sheet
Do While i < Worksheet.Rows.Count
'Check the contents of the first row in the record to ensure that it contains data
If Worksheet.Cells(2 + i, 1) <> "" Then
'Find the next empty row in the destination sheet to copy to
DestRow = DestSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
'Copy and paste data, using paste special because of the formatting and formulas in the source
Worksheet.Cells(2 + i, 1).Copy
DestSheet.Range("A" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Worksheet.Cells(2 + i, 2).Copy
DestSheet.Range("D" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Worksheet.Cells(3 + i, 2).Copy
DestSheet.Range("E" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Worksheet.Cells(4 + i, 2).Copy
DestSheet.Range("F" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Worksheet.Cells(2 + i, 7).Copy
DestSheet.Range("C" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Worksheet.Cells(5 + i, 7).Copy
DestSheet.Range("G" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Worksheet.Cells(14 + i, 2).Copy
DestSheet.Range("B" & DestRow).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Add 14 to counter, since the rows are equally spaced by 14
i = i + 14
Else
'If the first row contains no data, then exit the loop
Exit Do
End If
Loop
End If
Next
End Sub