Page 4 of 8 FirstFirst ... 23456 ... LastLast
Results 31 to 40 of 75

Thread: vba Copy Paste Conditional to put remark 1 2 3 .. etc

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hello.
    Quote Originally Posted by fixer View Post
    ...U have mentioned that ignore that post so till today i have not checked that code but today i thought to check the code if there will be any error i will try to solve it .....

    I am not really sure what you are saying here.
    I am sorry, but I do not understand you very well.
    I think you have difficulty speaking in English.
    ( Just out of interest, where do you come from?. What is your mother tongue? Have you tried this https://translate.google.de/?hl=de#v...te&sl=hi&tl=en )






    Quote Originally Posted by fixer View Post
    .. little modification in the code is required
    plz see the sample file
    This was last macro …
    If column B of 2.xlsm match with column B of 1.xls then paste the data from column C of 2.xls as 1,2,3,4,5 and so on....
    &
    If column B of 2.xlsm doesn't match with column B of 1.xls then delete all the data from column C of that row

    Code:
            If IsError(mtchRes) Then  '  If the last line errored than we did not find a match, so from the 3rd up to the last element need to be removed from the array for this row
            Dim Empt As Long
                For Empt = 3 To UBound(arr3(Cnt - 1), 2)
                 Let arr3(Cnt - 1)(1, Empt) = ""
                Next Empt
            Else
            ' a match was found, so we do not need to remove the  1   2   3   etc...
            End If
     
    _.______________________

    This is new requirement…
    If column B of 2.xlsm match with column B of 1.xls then clear all the data in that row from column C
    If column B of 2.xlsm does not match with column B of 1.xls then paste the data from column C of 2.xls as 1,2,3,4,5 and so on…

    New requirement is almost the same, but it is just now
    The other way around,
    or
    Upside down
    or,
    Standing on its head,
    or
    Arse over Tit
    Code:
            If IsError(mtchRes) Then  '  If the last line errored than we did not find a match, so we do not need to  do anything to the array
            ' a match was not found, so we do not need to remove the  1   2   3   etc...
            Else
            ' a match was found, so we need to remove the  1   2   3   etc...
            Dim Empt As Long
                For Empt = 3 To UBound(arr3(Cnt - 1), 2)
                 Let arr3(Cnt - 1)(1, Empt) = ""
                Next Empt
            End If
    ( Full macro is here:
    Sub CopyPasterConditionalToPutRemark_1_2_3_etcArseOverTit() http://www.excelfox.com/forum/showth...ll=1#post13176 )

    Before:
    _____ Workbook: 1 1mai.xlsx ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    1
    NSE
    15083
    6
    >
    70000
    A
    2
    NSE
    17388
    6
    >
    20000
    A
    3
    NSE
    100
    6
    >
    170000
    A
    4
    Worksheet: Sheet1

    _____ Workbook: 2 1Mai.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    Symbol
    2
    ACC
    22
    1
    3
    ADANIENT
    25
    1
    2
    3
    4
    ADANIPORTS
    15083
    1
    2
    3
    4
    5
    5
    ADANIPOWER
    17388
    1
    6
    AMARAJABAT
    100
    1
    2
    34
    5
    6
    7
    8
    9
    10
    7
    ASIANPAINT
    236
    1
    2
    8
    Worksheet: Sheet1



    After running macro here: http://www.excelfox.com/forum/showth...ll=1#post13176

    _____ Workbook: 2 1Mai.xlsm ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    1
    Symbol
    2
    ACC
    22
    1
    2
    3
    ADANIENT
    25
    1
    2
    3
    4
    4
    ADANIPORTS
    15083
    5
    ADANIPOWER
    17388
    6
    AMARAJABAT
    100
    7
    ASIANPAINT
    236
    1
    2
    3
    8
    Worksheet: Sheet1



    Molly
    Last edited by Molly Brennholz; 05-01-2020 at 06:23 PM.

  2. #2
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Thnx Alot Mam for giving ur Precious Time and Great Support in solving this Problem
    Problem Solved
    Have a Great Day

  3. #3
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Just out of interest, where do you come from?. What is your mother tongue?

    Myself Avinash Reside in Mumbai from India & mother tongue Hindi

  4. #4
    Thanks for that info.
    I am sorry to see that you have been banned.
    But I can understand why. You really must at least try a little to read and understand, or at the very least read what we write once.
    In your haste, you did not even see initially that I had written a full working macro for you here. Only by chance you noticed later!! I am sure you have ignored and / or missed much that has been done for you.
    This is very impolite and disrespectful. You should at least have the decency to read all we write. Then after you can ask for more explanations, or more help.
    But just continually asking and not even reading what we write is crazy

    I hope all works out well for you. Alan is a lovely guy. For him to ban anyone is something I never thought I would ever live to see…

    Take care and stay healthy
    Molly
    x

  5. #5
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Molly Mam i completely agree with u & Doc Sir & i know its my mistake & Sorry for the same Mam

  6. #6
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0

    Conditionally Copy & Paste of the data with increasing series with Matching

    All files are located in different path
    sheet name can be anything
    I have a file ap.xls & Book1.xlsm
    macro will be placed in Book1.xlsm
    We have to look on Column S of ap.xls and If column S of ap.xls has negative numbers then we have to look on Column E of ap.xls & we will match that Column E data of ap.xls with column A of sheet1 of Book1.xlsm & if it matches then we will see wheather column C of Book1.xlsm has data in it or not & if column C of Book1.xlsm has data in it then do nothing & if column C of Book1.xlsm doesn't have data then we will go to sheet3 of Book1.xlsm and we will look for a match of Column E data of ap.xls with column A of sheet3 of Book1.xlsm & if it is found then we will copy the data from sheet3 of Book1.xlsm and paste it to sheet1 of book1.xlsm & we increase one more number in series in it

    Sheet4 is the output that i need in Sheet1 (Result is pasted in sheet4 only for understanding purpose, i need result in sheet1 only)



    plz see the sample file
    Attached Files Attached Files

  7. #7
    Hello Avinash.
    Good to see you back!

    I have written a macro for you here: https://excelfox.com/forum/showthrea...ll=1#post13417




    I have written 'comments to explain the macro
    We all understand that you do not want to learn any VBA. But it is madness to not attempt to understand anything of the coding which we give you.
    I assume you will want to use these codings later for something important to you?
    If this is the case, then you will fail, because we will not be with you later every step of the adventure.
    You must make at least some attempt to understand the coding.

    But its your choice
    .

    Molly




    Macro is also in Book1.xlsm
    Share 'Book1.xlsm' : https://app.box.com/s/qotw65wmiq1aln7frg9o5gys8ke1l8xh
    Share 'ap.xls' : https://app.box.com/s/r0tc0hkwoxrqjsqfu4gh7eqyy5jmqlg2
    Last edited by Molly Brennholz; 05-22-2020 at 03:20 AM.

  8. #8
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Thnx Alot Molly Mam For giving ur Great Support & helping me in solving this problem Mam

    We all understand that you do not want to learn any VBA. But it is madness to not attempt to understand anything of the coding which we give you. (Thnx for understanding Me, But I Was Busy in making of Something & Now i am very near to get free time to do some work & then i will play with vba )


    we will not be with you later every step of the adventure.(That Day will be the worst day of mine But i will some how manage it & i don't want that day should come)



    Problem Solved

  9. #9
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    excelforum question 20 June

    _____ Workbook: 1 20June excelforum.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    1200
    1200
    1173
    1194.2
    1194.2
    22
    3
    NSE ADANIENT EQ
    141.4
    143.7
    141.4
    141.05
    141.05
    25
    4
    NSE ADANIPORTS EQ
    309
    309
    309
    309.25
    309.25
    15083
    5
    NSE ADANIPOWER EQ
    33.3
    33.3
    32.1
    32.35
    32.35
    17388
    6
    NSE AMARAJABAT EQ
    555
    578
    555
    572.85
    572.85
    100
    7
    NSE ASIANPAINT EQ
    1529
    1529
    1529
    1552.95
    1552.95
    236
    8
    Worksheet: 1-Sheet1 20 June excelforum
    If column D of 1.xls is equal to Column E of 1.xls & column D of 1.xls is not equal to column F of 1.xls then match Column I of 1.xls with column B of macro.xlsm & if it matches the put the remark in series as shown in the sample file(We will put the remark from column C of macro.xlsm & if column C has data then from column D and so on... in series wise)
    If column D of 1.xls is equal to Column F of 1.xls & column D of 1.xls is not equal to column E of 1.xls then match Column I of 1.xls with column B of macro.xlsm & if it matches the put the remark in series as shown in the sample file(We will put the remark from column C of macro.xlsm & if column C has data then from column D and so on... in series wise)
    If column D of 1.xls is equal to Column F of 1.xls & column D of 1.xls is equal to column E of 1.xls then don't do anything
    Plz note: Macro will be placed in macro.xlsm which i have attached below & 1.xls & macro.xlsm may be in different path so I will edit the path As per my needs
    _____ Workbook: Macro 20June excelforum.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K L M
    1 Symbol
    2 ACC 22 1 2 3 4
    3 ADANIENT 25 1 2 3
    4 ADANIPORTS 15083 1
    5 ADANIPOWER 17388 1 2 3 4 5 6 7
    6 AMARAJABAT 100 1 2 3 4 5 6 7 8 9 10 11
    7 ASIANPAINT 236
    Worksheet: Sheet1 20 June excelforum
    Code:
    Symbol												
    ACC	        22	1	2	3	4							
    ADANIENT	25	1	2	3								
    ADANIPORTS	15083	1										
    ADANIPOWER	17388	1	2	3	4	5	6	7				
    AMARAJABAT	100	1	2	3	4	5	6	7	8	9	10	11
    ASIANPAINT	236											
    AMBUJACEM	1270											
    APOLLOHOSP	157											
    APOLLOPIPE	14361											
    ASHOKLEY	212											
    AUROPHARMA	275											
    AXISBANK	5900											
    BAJAJ-AUTO	16669											
    BAJAJFINSV	16675											
    BAJFINANCE	317											
    BALKRISIND	335											
    BANKBARODA	4668											
    BATAINDIA	371											
    BEL	        383											
    BERGEPAINT	404											
    BHARATFORG	422											
    BHARTIARTL	10604											
    BHEL	             438											
    BIOCON	11373											
    BOSCHLTD	2181											
    BPCL	             526											
    BRITANNIA	547											
    CADILAHC	7929											
    CANBK	    10794											
    CASTROLIND	1250											
    CENTURYTEX	625											
    CESC	        628											
    CHOLAFIN	685											
    CIPLA	        694											
    COALINDIA	20374											
    COLPAL	15141											
    CONCOR	4749											
    CUMMINSIND	1901											
    DABUR	772											
    DIVISLAB	10940											
    DLF	         14732											
    DRREDDY	881											
    EICHERMOT	910											
    EQUITAS	16852											
    ESCORTS	958											
    EXIDEIND	676											
    FEDERALBNK	1023											
    GAIL	         4717											
    GLENMARK	7406											
    GMRINFRA	13528											
    GODREJCP	10099											
    GRASIM   	1232											
    HAVELLS	9819											
    HCLTECH	7229											
    HDFC   	1330											
    HDFCBANK	1333											
    HEROMOTOCO	1348											
    HINDALCO	1363											
    HINDPETRO	1406											
    HINDUNILVR	1394											
    IBULHSGFIN	30125											
    ICICIBANK	4963											
    ICICIPRULI	18652											
    IDEA	        14366											
    IDFCFIRSTB	11184											
    IGL	        11262											
    INDIGO	11195											
    INDUSINDBK	5258											
    INFRATEL	29135											
    INFY	       1594											
    IOC	       1624											
    ITC	       1660											
    JINDALSTEL	6733											
    JSWSTEEL	11723											
    JUBLFOOD	18096											
    JUSTDIAL	29962											
    KOTAKBANK	1922											
    L&TFH	     24948											
    LICHSGFIN	1997											
    LT	       11483											
    LUPIN	10440											
    M&M	        2031											
    M&MFIN	13285											
    MANAPPURAM	19061											
    MARICO	4067											
    MARUTI	10999											
    MCDOWELL-N	10447											
    MFSL	          2142											
    MGL	          17534											
    MINDTREE	14356											
    MOTHERSUMI	4204											
    MRF	           2277											
    MUTHOOTFIN	23650											
    NATIONALUM	6364											
    NBCC	         31415											
    NCC	         2319											
    NESTLEIND	17963											
    NIITTECH	11543											
    NMDC	15332											
    NTPC	        11630											
    OIL	         17438											
    ONGC	2475											
    PAGEIND	14413											
    PEL	            2412											
    PETRONET	11351											
    PFC	                14299											
    PIDILITIND	2664											
    PNB	                 10666											
    POWERGRID	14977											
    PVR	                     13147											
    RAMCOCEM	2043											
    RBLBANK	18391											
    RECLTD	15355											
    RELIANCE	2885											
    SAIL	                     2963											
    SBIN	                  3045											
    SHREECEM	3103											
    SIEMENS	3150											
    SRF	                    3273											
    SRTRANSFIN	4306											
    SUNPHARMA	3351											
    SUNTV	13404											
    TATACHEM	3405											
    TATAMOTORS	3456											
    TATAMTRDVR	16965											
    TATAPOWER	3426											
    TATASTEEL	3499											
    TCS	                  11536											
    TECHM	13538											
    TITAN	3506											
    TORNTPHARM	3518											
    TORNTPOWER	13786											
    TVSMOTOR	8479											
    UBL	                   16713											
    UJJIVAN	17069											
    ULTRACEMCO	11532											
    UPL	                11287											
    VEDL	                  3063											
    VOLTAS	3718											
    WIPRO	3787											
    ZEEL	                 3812
    Last edited by DocAElstein; 06-26-2020 at 03:15 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!!

  10. #10
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10

    Alternative Solutions from other forums

    This and the next few posts are purely done out of interest looking at the alternative solutions supplied elsewhere for the similar question…. vba Copy Paste Conditional to put remark 1 2 3 .. etc…..

    Here we analyse the solutions to this….



    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    Exchange Symbol Series/Expiry Open High Low Prev Close LTP
    2
    NSE ACC EQ
    1200
    1200
    1173
    1194.2
    1194.2
    22
    3
    NSE ADANIENT EQ
    141.4
    143.7
    141.4
    141.05
    141.05
    25
    4
    NSE ADANIPORTS EQ
    309
    309
    309
    309.25
    309.25
    15083
    5
    NSE ADANIPOWER EQ
    33.3
    33.3
    32.1
    32.35
    32.35
    17388
    6
    NSE AMARAJABAT EQ
    555
    578
    555
    572.85
    572.85
    100
    7
    NSE ASIANPAINT EQ
    1529
    1529
    1529
    1552.95
    1552.95
    236
    8
    Worksheet: 1-Sheet1 20 June excelforum

    If column D of 1.xls is equal to Column E of 1.xls & column D of 1.xls is not equal to column F of 1.xls then match Column I of 1.xls with column B of macro.xlsm & if it matches the put the remark in series as shown in the sample file(We will put the remark from column C of macro.xlsm & if column C has data then from column D and so on... in series wise)
    If column D of 1.xls is equal to Column F of 1.xls & column D of 1.xls is not equal to column E of 1.xls then match Column I of 1.xls with column B of macro.xlsm & if it matches the put the remark in series as shown in the sample file(We will put the remark from column C of macro.xlsm & if column C has data then from column D and so on... in series wise)
    If column D of 1.xls is equal to Column F of 1.xls & column D of 1.xls is equal to column E of 1.xls then don't do anything
    Plz note: Macro will be placed in macro.xlsm which i have attached below & 1.xls & macro.xlsm may be in different path so I will edit the path As per my needs
    _____ Workbook: macro.xlsm ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K L M
    1 Symbol
    2 ACC 22 1 2 3 4
    3 ADANIENT 25 1 2 3
    4 ADANIPORTS 15083 1
    5 ADANIPOWER 17388 1 2 3 4 5 6 7
    6 AMARAJABAT 100 1 2 3 4 5 6 7 8 9 10 11
    7 ASIANPAINT 236
    Worksheet: Sheet1 20 June excelforum
    Code:
    Symbol												
    ACC	        22	1	2	3	4							
    ADANIENT	25	1	2	3								
    ADANIPORTS	15083	1										
    ADANIPOWER	17388	1	2	3	4	5	6	7				
    AMARAJABAT	100	1	2	3	4	5	6	7	8	9	10	11
    ASIANPAINT	236											
    AMBUJACEM	1270											
    APOLLOHOSP	157											
    APOLLOPIPE	14361											
    ASHOKLEY	212											
    AUROPHARMA	275											
    AXISBANK	5900											
    BAJAJ-AUTO	16669											
    BAJAJFINSV	16675											
    BAJFINANCE	317											
    BALKRISIND	335											
    BANKBARODA	4668											
    BATAINDIA	371											
    BEL	        383											
    BERGEPAINT	404											
    BHARATFORG	422											
    BHARTIARTL	10604											
    BHEL	             438											
    BIOCON	11373											
    BOSCHLTD	2181											
    BPCL	             526											
    BRITANNIA	547											
    CADILAHC	7929											
    CANBK	    10794											
    CASTROLIND	1250											
    CENTURYTEX	625											
    CESC	        628											
    CHOLAFIN	685											
    CIPLA	        694											
    COALINDIA	20374											
    COLPAL	15141											
    CONCOR	4749											
    CUMMINSIND	1901											
    DABUR	772											
    DIVISLAB	10940											
    DLF	         14732											
    DRREDDY	881											
    EICHERMOT	910											
    EQUITAS	16852											
    ESCORTS	958											
    EXIDEIND	676											
    FEDERALBNK	1023											
    GAIL	         4717											
    GLENMARK	7406											
    GMRINFRA	13528											
    GODREJCP	10099											
    GRASIM   	1232											
    HAVELLS	9819											
    HCLTECH	7229											
    HDFC   	1330											
    HDFCBANK	1333											
    HEROMOTOCO	1348											
    HINDALCO	1363											
    HINDPETRO	1406											
    HINDUNILVR	1394											
    IBULHSGFIN	30125											
    ICICIBANK	4963											
    ICICIPRULI	18652											
    IDEA	        14366											
    IDFCFIRSTB	11184											
    IGL	        11262											
    INDIGO	11195											
    INDUSINDBK	5258											
    INFRATEL	29135											
    INFY	       1594											
    IOC	       1624											
    ITC	       1660											
    JINDALSTEL	6733											
    JSWSTEEL	11723											
    JUBLFOOD	18096											
    JUSTDIAL	29962											
    KOTAKBANK	1922											
    L&TFH	     24948											
    LICHSGFIN	1997											
    LT	       11483											
    LUPIN	10440											
    M&M	        2031											
    M&MFIN	13285											
    MANAPPURAM	19061											
    MARICO	4067											
    MARUTI	10999											
    MCDOWELL-N	10447											
    MFSL	          2142											
    MGL	          17534											
    MINDTREE	14356											
    MOTHERSUMI	4204											
    MRF	           2277											
    MUTHOOTFIN	23650											
    NATIONALUM	6364											
    NBCC	         31415											
    NCC	         2319											
    NESTLEIND	17963											
    NIITTECH	11543											
    NMDC	15332											
    NTPC	        11630											
    OIL	         17438											
    ONGC	2475											
    PAGEIND	14413											
    PEL	            2412											
    PETRONET	11351											
    PFC	                14299											
    PIDILITIND	2664											
    PNB	                 10666											
    POWERGRID	14977											
    PVR	                     13147											
    RAMCOCEM	2043											
    RBLBANK	18391											
    RECLTD	15355											
    RELIANCE	2885											
    SAIL	                     2963											
    SBIN	                  3045											
    SHREECEM	3103											
    SIEMENS	3150											
    SRF	                    3273											
    SRTRANSFIN	4306											
    SUNPHARMA	3351											
    SUNTV	13404											
    TATACHEM	3405											
    TATAMOTORS	3456											
    TATAMTRDVR	16965											
    TATAPOWER	3426											
    TATASTEEL	3499											
    TCS	                  11536											
    TECHM	13538											
    TITAN	3506											
    TORNTPHARM	3518											
    TORNTPOWER	13786											
    TVSMOTOR	8479											
    UBL	                   16713											
    UJJIVAN	17069											
    ULTRACEMCO	11532											
    UPL	                11287											
    VEDL	                  3063											
    VOLTAS	3718											
    WIPRO	3787											
    ZEEL	                 3812
    Last edited by DocAElstein; 06-27-2020 at 12:16 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!!

Similar Threads

  1. Replies: 26
    Last Post: 09-26-2020, 05:56 PM
  2. VBA -- Copy/Paste across sheets
    By Rasm in forum Excel Help
    Replies: 4
    Last Post: 09-21-2012, 02:07 PM

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
  •