Results 1 to 10 of 86

Thread: Copy Paste based on comparisons calculations in 2 XL files, 1 might be .csv file .Opened in XL=Fail/Chaos

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0

    Copy Paste based on comparisons calculations in 2 XL files, 1 might be .csv file .Opened in XL=Fail/Chaos

    Copy and Paste based on comparisons and calculations of cells in two excel files, 1 might be .csv file .Opened in Excel=Fail Chaos

    Moderator Notice:
    This is the start of two months of wasting everybodies time going around in circles making a total mess in posts everywhere because he refuses to understand anything at all about Text files.
    The biggest problem is in using an Excel object to open a .csv File, which is usually not a good idea.
    Sometimes you might get the impression he is understanding at least a small part of the problem, but wither it is just co incidence that what he has pasted infers that and he has no idea what he is writing, or two seconds later he forgets and we are back to the starting point and he starts again duplicating cross posting the same question… - I think there is a good chance the OP is insane, and certainly a total dim pig shit for brains. Physical violence is I think the only hope for him, and if all else fails then he should be put to death
    3 Bans and he still just goes off and starts again at another forum, gets no where , annoys everyone, then comes back here again and starts agin here making exactly the same mistakes...





    All files are located in a different path

    vba code will be placed in a macro.xlsm

    i have two files 1.xls & 2.csv

    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



    save and close both the file

    plz help me in solving this problem by vba



    i have a vba code but has a little error plz have a look sir
    Code:
    Sub STEP8()
    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.Open("C:\Users\WolfieeeStyle\Desktop\1.xls")
    Set Wb2 = 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
        Set c = Ws2.Columns(2).Find(.Cells(i, 9))
        If Not c Is Nothing Then 'if match found
        c.Offset(, 2).Value = "<"
        c.Offset(, 3).Value = .Cells(i, 11)
        End If
        Else
        Set c = Ws2.Columns(2).Find(.Cells(i, 9))
        If Not c Is Nothing Then 'if match found
        c.Offset(, 2).Value = ">"
        c.Offset(, 3).Value = .Cells(i, 11)
        End If
        End If
        Next i
    End With
    End Sub

    I was unable to upload alert..csv so i am uploading a pic of the same sir So plz have a look and help me out in solving this problem Sir
    Attached Images Attached Images
    Attached Files Attached Files
    • File Type: xls 1.xls (49.5 KB, 3 views)
    Last edited by DocAElstein; 06-25-2020 at 12:18 PM.

Similar Threads

  1. Replies: 26
    Last Post: 09-26-2020, 05:56 PM
  2. Copy paste data based on criteria
    By analyst in forum Excel Help
    Replies: 7
    Last Post: 01-13-2014, 12:46 PM
  3. Replies: 8
    Last Post: 10-31-2013, 12:38 AM
  4. Replies: 2
    Last Post: 09-18-2013, 12:30 AM

Tags for this Thread

Posting Permissions

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