Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 07-18-2017, 06:26 AM
NoSparks NoSparks is offline Copy, sort, remove doubles, Cartesian product Windows 7 64bit Copy, sort, remove doubles, Cartesian product 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
 

Tags
cartesian product, copy, sort



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy, sort, remove doubles, Cartesian product Remove the * from the SubCate, Custom Sort, Replace..Help Please - I need. Thanks shilabrow Excel Programming 2 07-10-2014 11:09 AM
Copy, sort, remove doubles, Cartesian product How can I avoid doubles? s7y Excel 13 05-15-2012 01:17 PM
Copy, sort, remove doubles, Cartesian product Mail Merge Doubles My Document ExecAssist Mail Merge 1 02-27-2012 04:06 PM
How to remove background when copy and paste, no fill doesn't work. mingo Word 1 07-29-2010 02:25 PM
installing copy of XP prof. without product # vicky Office 0 04-09-2006 07:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft