Results 1 to 10 of 604

Thread: Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    From last post
    Before
    _____ Workbook: Alert.txt ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    NSE
    14361
    6
    A
    2
    NSE
    25
    6
    A
    3
    NSE
    15083
    6
    A
    4
    NSE
    17388
    6
    A
    5
    NSE
    100
    6
    A
    6
    NSE
    22
    6
    A
    7
    Worksheet: Alert

    check wheather column H of 1.xls is greater or lower than column D of 1.xls

    if column H of 1.xls is greater than column D of 1.xls then match column I of 1.xls with column B of 2.csv & if it matches then put this symbol "<" in column D of 2.csv & copy paste the data of column K of 1.xls in column E of 2.csv

    or

    if column H of 1.xls is lower than column D of 1.xls then match column I of 1.xls with column B of 2.csv & if it matches then put this symbol ">" in column D of 2.csv & copy paste the data of column K of 1.xls in column E of 2.csv
    Run macro ( from here https://www.ozgrid.com/forum/index.p...54#post1233954 )
    Code:
    Sub STEP8() '   http://www.excelfox.com/forum/showthread.php/2461-copy-and-paste-by-vba?p=13126&viewfull=1#post13126
    Dim Wb1 As Workbook, Wb2 As Workbook
    Dim Ws1 As Worksheet, Ws2 As Worksheet
    Dim rg1 As Range, i As Long, c As Range
    Set Wb1 = Workbooks("1.xls")       '  Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\1.xls")
    Set Wb2 = Workbooks("Alert.txt")   '  Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\Alert..csv")
    Set Ws1 = Wb1.Worksheets.Item(1)
    Set Ws2 = Wb2.Worksheets.Item(1)
    Set rg1 = Ws1.Cells(1, 1).CurrentRegion
        With rg1
            For i = 2 To rg1.Rows.Count
                If .Cells(i, 8) > .Cells(i, 4) Then    ' if column H of 1.xls is greater than column D of 1.xls
                Set c = Ws2.Columns(2).Find(.Cells(i, 9)) ' match column I of 1.xls with column B of 2.csv
                    If Not c Is Nothing Then 'if match found
                    c.Offset(, 2).Value = "<"          '  put this symbol "<" in column D of 2
                    c.Offset(, 3).Value = .Cells(i, 11) '  copy paste the data of column K of 1.xls in column E of 2.csv
                    End If
                Else   '    if column H of 1.xls is lower than column D of 1.xls
                Set c = Ws2.Columns(2).Find(.Cells(i, 9)) '  match column I of 1.xls with column B of 2.csv
                    If Not c Is Nothing Then 'if match found
                    c.Offset(, 2).Value = ">"            '  then put this symbol ">" in column D of 2.csv
                    c.Offset(, 3).Value = .Cells(i, 11)  '  copy paste the data of column K of 1.xls in column E of 2.csv
                    End If
                End If
            Next i
        End With
    End Sub
    After - results after running macro above

    _____ Workbook: Alert.txt ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    NSE
    14361
    6
    A
    2
    NSE
    25
    6
    >
    13595
    A
    3
    NSE
    15083
    6
    >
    27335
    A
    4
    NSE
    17388
    6
    >
    3095
    A
    5
    NSE
    100
    6
    <
    5374
    A
    6
    NSE
    22
    6
    >
    116815
    A
    7
    Worksheet: Alert




    1.xls : https://app.box.com/s/38aoip5xi7018y9syt0xe4g04u95l6xk
    macro.xlsm : https://app.box.com/s/599q2it3uck3hfwm5kscmmgtn0be66wt
    Alert.csv : https://app.box.com/s/4ejptbaggn67nc91yz9jhgcefm2qae0r
    Attached Files Attached Files
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Testing Concatenating with styles
    By DocAElstein in forum Test Area
    Replies: 2
    Last Post: 12-20-2020, 02:49 AM
  2. testing
    By Jewano in forum Test Area
    Replies: 7
    Last Post: 12-05-2020, 03:31 AM
  3. Replies: 18
    Last Post: 03-17-2019, 06:10 PM
  4. Concatenating your Balls
    By DocAElstein in forum Excel Help
    Replies: 26
    Last Post: 10-13-2014, 02:07 PM
  5. Replies: 1
    Last Post: 12-04-2012, 08:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •