Page 4 of 9 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 86

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

  1. #31
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Doc Sir this code has issue when i ran with 200 stocks it is doing incorrect work
    So it's my request u plz remake the code for the same Doc Sir ignore this vba code
    the condition written in vba language has some errors
    Attached Images Attached Images

  2. #32
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    I see no problem with the macro from dangelor
    So if I write a new macro it may also give the same error. My macro would be very similar to that for dangelor. So most likely it will also error.


    Your last screenshots are useless. They tell me nothing.
    I do not understand what you are showing me with the screenshots. I do not understand what error you are showing.


    Try to make and upload a small file with also row data that errors.
    Explain again and show me what and where the errors are….
    ….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!!

  3. #33
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Sure Doc Sir i have atttached the sample file plz run the macro and see the output Doc Sir
    and plz convert alert.xlsx to alert..csv (bcoz i was not able to upload csv so i converted the file to xlsx so plz convert it into csv and then run the macro Doc Sir)
    Attached Files Attached Files

  4. #34
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    The problem is that you are matching an empty cell
    See here:- http://www.excelfox.com/forum/showth...ll=1#post13133

    So what do you want to do if call in column I is empty??


    Cell I41 is Empty:
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    38
    NSE CONCOR EQ
    368
    376.6
    359.5
    367.8
    361.1
    4749
    3.611
    3647
    364.711
    39
    NSE CUMMINSIND EQ
    420.95
    426.55
    377.25
    419.15
    384.95
    1901
    3.8495
    38875
    388.7995
    40
    NSE DABUR EQ
    499
    503.75
    494.5
    499
    499.05
    772
    4.9905
    4941
    494.0595
    41
    NSE DISHTV EQ
    5.1
    5.15
    4.75
    4.95
    4.75
    Empty
    0.0475
    475
    4.7975
    42
    NSE DIVISLAB EQ
    2410
    2460
    2390.6
    2417.3
    2425.4
    10940
    24.254
    240115
    2401.146
    43
    NSE DLF EQ
    135
    135
    127.6
    137
    128.2
    14732
    1.282
    12945
    129.482
    44
    NSE DRREDDY EQ
    4010
    4049.6
    3970.1
    4027.1
    4002.8
    881
    40.028
    40428
    4042.828
    Worksheet: 1-Sheet1 27Apr_2
    Last edited by DocAElstein; 04-26-2020 at 06:35 PM.
    ….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!!

  5. #35
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    do nothing for empty cell Doc Sir

  6. #36
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Column Letter I is column number 9

    So
    Code:
            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
                If Not .Cells(i, 9).Value = "" Then 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
                If Not .Cells(i, 9).Value = "" Then 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
    OR

    Code:
            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
                    If .Cells(i, 9).Value = "" Then
                    ' do nothing
                    Else
                    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
                    End If
                Else   '    if column H of 1.xls is lower than column D of 1.xls
                    If .Cells(i, 9).Value = "" Then
                    ' do nothing
                    Else
                    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
                End If
            Next i
    Last edited by DocAElstein; 04-26-2020 at 06:53 PM.
    ….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!!

  7. #37
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Doc Sir code is not proper, its my fault (i was not able to explained u [misunderstanding ]) let me explain
    there are some datas who has a match but it was not matched by the vba code
    i am attaching a sample pic of the same (there are many more matches i have attached only two sample pic)

    error1 it has a match plz see but the vba code doesnt matches the same
    error2 it has a match plz see but the vba code doesnt matches the same
    there are many more data who has a match
    Attached Images Attached Images

  8. #38
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    Upload file with small number of rows < 30 , to demonstrate all remaining problems
    Explain what rows are not working
    Last time to tell you : In forum test data just enough rows to show all problems!!!
    I showed you:- http://www.excelfox.com/forum/showth...ll=1#post13133

    Take your time and do it right. I am busy now until later...
    ….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!!

  9. #39
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Doc Sir i checked all the details No Doubt code has issue
    i tried changing i=1 also but after that also i am not getting correct output
    this code is working perfect with small data file but with the file which i sented u of 200 stocks it is not working
    if i share less data file then it will show correct result and again u will tell me the code is perfect but with the file which i sented u its not working plz run the macro and see only the cells that doesnt has data and check the same in 1.xls it is there or not u will see it is there then question arises why the data is not pasted plz ran the macro and see it

  10. #40
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    You are right
    OK, now see what the problem is.
    The macro is bad
    You are right, forget the macro, it is a bad macro. There are many wrong values
    Now I am busy, but tomorrow I will write you a new macro

    Alan
    ….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. 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
  •