Hi guys,
I have the following code which I'm using to find the last 10 rows that have something in them, and then copy the data into a summary table. The code works fine. The only problem is when the data gets pasted into the summary table, for some reason Excel is applying conditional formatting to some of the cells in the summary table. I have no idea why because the cells that I'm copying from don't have conditional formatting in them (although some others on the worksheet do).
Does anyone know why this is happening? I've noticed the same thing on some other macros that I've written and used to move data around my spreadsheets. I don't know if it's the code I've written or something else with Excel in general?
Sub LastTenEngines()
Dim EngineArray(10, 11) As Variant
Dim i As Integer
Dim lngCols(11) As Long
Dim vntCol As Variant
Dim lngRow As Long
Dim lngCol As Long
Dim SumRow As Integer
Dim SumCol As Integer
Application.ScreenUpdating = False
Worksheets("DATA").Select
For Each vntCol In Split("C,BF,BI,BK,BM,BO,BQ,BS,BU,BW,BY", ",")
lngCol = lngCol + 1
lngCols(lngCol) = Range(vntCol & "1").Column
Next
lngRow = Cells(Rows.Count, 6).End(xlUp).Row ' get last row
' work way back up the rows populating array from last element
i = 10
Do While lngRow >= 9
If Len(Cells(lngRow, 6)) > 0 Then
For lngCol = 1 To 11
EngineArray(i, lngCol) = Cells(lngRow, lngCols(lngCol))
Next
i = i - 1
End If
lngRow = lngRow - 1
If i = 0 Then Exit Do
Loop
Worksheets("SUMMARY").Select
For SumRow = 1 To 10
For SumCol = 1 To 11
Worksheets("SUMMARY").Cells(6 + SumRow, 1 + SumCol) = EngineArray(SumRow, SumCol)
Next SumCol
Next SumRow
End Sub
Cheers,
Chris
Bookmarks