View Single Post
 
Old 07-18-2017, 06:26 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

I think this is what you're asking for regarding 4 through 6.
I don't see it as being a layout that would be workable for anything, but I have no idea what a Cartesian Product is.
Hope this helps.
Code:
' 4) copy all the data between degrees 0 to 70 to the previous column G
Dim lastRowH As Long, lastRowG As Long
Dim cel As Range, rng As Range

With Sheets("Sheet8")
    lastRowH = .Cells(Rows.Count, "H").End(xlUp).Row
    For Each cel In .Range("H2:H" & lastRowH)
        If cel.Value >= 0 And cel.Value <= 70 Then
            cel.Offset(0, -1).Value = cel.Value
        End If
    Next cel
' 5) Copy the same data beneath on column G but multiplied by minus
    lastRowG = .Cells(Rows.Count, "G").End(xlUp).Row
    .Range("G2:G" & lastRowG).Copy .Range("G" & lastRowG + 1)
    For Each cel In .Range("G" & lastRowG + 1 & ":G" & .Cells(Rows.Count, "G").End(xlUp).Row)
        cel.Value = cel.Value * -1
    Next cel
' 6) at H column all the degrees to be copied beneath but multiplied by minus
    .Range("H2:H" & lastRowH).Copy .Range("H" & lastRowH + 1)
    For Each cel In .Range("H" & lastRowH + 1 & ":H" & .Cells(Rows.Count, "H").End(xlUp).Row)
        cel.Value = cel.Value * -1
    Next cel

End With
Reply With Quote