|First, a posting tip: |
Please click on the blue line at the end of this post and read the instructions on how to post VBA code in this forum so that it is easier for us to read. Then edit/repost your code so that it looks similar to the example found via that link. Thanks!
As far as your statement "when i try to run following code it gives error on assigning value to R1" I have 2 comments:
1 - It might help if you told us exactly what error the code is showing. There are so many errors that VBA can present that telling us "it gives error" doesn't give us much to work with.
2 - Since we have no idea what your data looks like, it's hard for us to test your code and possibly reproduce the error. We don't know if you are working with numbers, text, dates, etc. If you could supply some example data for us to work with, that might help.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.