rwmill9716
Active Member
- Joined
- May 20, 2006
- Messages
- 485
- Office Version
- 2013
- Platform
- Windows
I am using the following macro on two Windows 8 based computers with no problems. This macro pulls columns of data from tab "Washed Raw Data" (all possible pairs), writes them to tab "Calculated Results" (one pair at a time) then calculates their correlation coefficient and various other id parameters in Cols J throug N which dynamicly add rows.
When I upload the Excel sheet (2010 versuib) and try to use it on two other computers, I get a compile error where Col1 is highlighted in the 11th line of code (For Col1 = 1 To LastCol).
Any suggestions would be appreciated.
Thanks,
ric
When I upload the Excel sheet (2010 versuib) and try to use it on two other computers, I get a compile error where Col1 is highlighted in the 11th line of code (For Col1 = 1 To LastCol).
Any suggestions would be appreciated.
Thanks,
ric
Code:
Sub Partiton_Pairs()
Dim LastCol As Long, Col As Long, LastRow As Long
Dim rData As Range
Application.ScreenUpdating = False
With Sheets("Washed Raw Data")
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
Set rData = .Range("A1").Resize(LastRow, LastCol)
End With
With Sheets("Calculated Results")
For Col1 = 1 To LastCol
For Col = Col1 + 1 To LastCol
.Range("B6").Resize(LastRow).Value = rData.Columns(Col1).Value
.Range("C6").Resize(LastRow).Value = rData.Columns(Col).Value
Application.EnableEvents = False
Range("J" & Rows.Count).End(xlUp).Offset(1) = Range("E7").Value
Range("K" & Rows.Count).End(xlUp).Offset(1) = Range("f7").Value
Range("L" & Rows.Count).End(xlUp).Offset(1) = Range("G7").Value
Range("M" & Rows.Count).End(xlUp).Offset(1) = Range("H7").Value
Range("N" & Rows.Count).End(xlUp).Offset(1) = Range("I7").Value
Application.EnableEvents = True
Next Col
Next Col1
End With
Application.ScreenUpdating = True
End Sub