A little help would be greatly appreciated and I thank everyone in advance. I am useing the coding below. I need to copy data from one file to another. When I exprt my data to this file sometimes it doesn't export all of the column headers from the access file. I don't ahve access to change that report so I need to deal with what I am dealt. The only way I have found is that the first entry in what I want to copy is a "1". Then I just need to count the number of times "1" comes up and copy those particular groups of data. (ie if b = 1 then could also be if b = 12 then) If anyone has a better idea I would love the input. Also if I could set the '.Range ("E10")' up as a variable I could cut down on the coding involved.
If b = 1 Then
With Worksheets("12")
If ((Worksheets("12").Range("C" & a)) = "1") Then
.Range("D" & a, "D" & a + 3).Copy
Workbooks("compileStats.xls").Worksheets("Sheet1").Range("E10").PasteSpecial xlPasteAll
.Range("F" & a, "F" & a + 3).Copy
Workbooks("compileStats.xls").Worksheets("Sheet1").Range("G10").PasteSpecial xlPasteAll
b = b + 1
End If
End With
End If
If b = 1 Then
With Worksheets("12")
If ((Worksheets("12").Range("C" & a)) = "1") Then
.Range("D" & a, "D" & a + 3).Copy
Workbooks("compileStats.xls").Worksheets("Sheet1").Range("E10").PasteSpecial xlPasteAll
.Range("F" & a, "F" & a + 3).Copy
Workbooks("compileStats.xls").Worksheets("Sheet1").Range("G10").PasteSpecial xlPasteAll
b = b + 1
End If
End With
End If