split,Copy paste cell Based on Criteria

  • Hi All,


    Inopportunely :( I don't know much about the VBA language so I'll appreciate it if you could help me on this. I want macro to split dollar and percentage values based on prefix string and copy result and paste based on next sheet Headers and ID. I have attached sample workbook.
    Thank you in advance.


    Regards,
    Dev

  • Re: split,Copy paste cell Based on Criteria


    It would be helpful to have a few more examples in your file to get an idea of the variability. Otherwise somebody may post code which works on your sample but doesn't work on your actual file if there are differences.

  • Re: split,Copy paste cell Based on Criteria


    First of all Thank you for your time!


    I have data in same format which is in file but each cell have more no. of sentences. But "apple" and "orange" words are comes one time in each cell. :read:


    Also apple values are end with before orange and spaces.


    For example, common thing is highlighted below,


    we received Apple profit--$150 and orange profit--- $52 and 20%


    I want split after apple before orange if any $ and % numbers are there combine and paste target cell. same for Orange data also.


    Hope u have any idea on over all! :)


    Regards,
    Dev

  • Re: split,Copy paste cell Based on Criteria


    This seems to work for your sample file

  • Re: split,Copy paste cell Based on Criteria


    Could you please Explain this lines? I am not able to understand!


    Code
    ws2.Range("B" & Rows.Count).End(xlUp)(2) = .Execute(r)(0).submatches(1) & IIf(.Execute(r)(0).submatches(3) = vbNullString, "", "/" & _ 
                    .Execute(r)(0).submatches(3))
  • Re: split,Copy paste cell Based on Criteria


    Based on your coding I can change some lines based on my requirements. But result comes only first pattern its not moving to next if condition! I don't know why? Could you say where I wrong?


    please find my below code... FYI


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!