+ Reply to Thread
Results 1 to 26 of 26

copy range in another sheet and create border

  1. #1
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    copy range in another sheet and create border

    I need to copy column C and D, from row 3 to the end, from sheet2,in sheet1, column A and B, starting with row 2 and after that I need to create a border to the copied values and I need to create a border to the empty cell from column C.
    Please open attached file
    Thank you!
    Last edited by iscar_marius; 02-15-2009 at 07:24 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    It would be nice to see you attempting some code yourself! I gave you sample code earlier to copy a range. This could easily be adapted to do what you want, then all you would need is code to add the borders!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    It would be nice to see you attempting some code yourself! I gave you sample code earlier to copy a range. This could easily be adapted to do what you want, then all you would need is code to add the borders!
    Before posting I always attempt on my own but without succes this time ..

    Please Login or Register  to view this content.
    I tried this code, it works to copy the desired data but also it delete range A1 and B1, and I don't understand why

  4. #4
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Please Login or Register  to view this content.
    I added the green code for the border, but it will make border only for column A and B. I don't know how to select column C also because it has no values.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: copy range in another sheet and create border

    Maybe ...
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    Will Sheet1 have data in & the formatting?

  7. #7
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    Will Sheet1 have data in & the formatting?
    I don't understand your question, sorry.
    Sheet 1 has data in range A1,B1,C1 and I have to copy data from sheet2.

  8. #8
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by shg View Post
    Maybe ...
    Please Login or Register  to view this content.


    Please Login or Register  to view this content.
    I don't think this is exactly what I need because if I have data in Column E in "sheet2" , the code will copy this data too.I would like to copy only from column C and D.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    Hi shg, I don't think you are adding the borders with your code. I've created a Style called Borders and then amended the code to this
    Please Login or Register  to view this content.
    iscar_marius, to create the style

    Select a cell that is already formatted as you want
    From the Format menu choose Styles
    In the Style name Box type Borders
    Click Add
    The style is now available in that workbook


  10. #10
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    Hi shg, I don't think you are adding the borders with your code. I've created a Style called Borders and then amended the code to this
    Please Login or Register  to view this content.
    iscar_marius, to create the style

    Select a cell that is already formatted as you want
    From the Format menu choose Styles
    In the Style name Box type Borders
    Click Add
    The style is now available in that workbook

    Almost what I need, but thie code will delete data from range A1,B1 and C1 (sheet1) and I don't need that.

    Also this code:
    Please Login or Register  to view this content.
    Will copy data also from column E if is not empty and I don't want that.

    Thanks for the code and for "style", I didn't know that.

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: copy range in another sheet and create border

    Will copy data also from column E if is not empty and I don't want that.
    Iscar, that's why it's helpful to post an example that reflects your actual data layout.

  12. #12
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by shg View Post
    Iscar, that's why it's helpful to post an example that reflects your actual data layout.
    I'm trying to keep my examples as simple as possible. But you are right.
    Sorry!

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    Your posted code deleted the data! So you want to keep that data & post below it?

  14. #14
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    Your posted code deleted the data! So you want to keep that data & post below it?
    Yes!
    I want to keep the data from Sheet1, range A1, B1 and C1, and copy in range A2, from sheet2 range C3-End(xlUp) and range D3-End(xlUp).
    Which part of the code deleted "Sheet1, range A1, B1 and C1" ?

  15. #15
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    This code clears the data
    Please Login or Register  to view this content.
    Try this
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    This code clears the data
    Please Login or Register  to view this content.
    Try this
    Please Login or Register  to view this content.
    Please open attached file!
    Not exactly what I need because this code will copy data also from column E (sheet2) if is not empty and I don't need that.


    I was expecting that this code:
    Please Login or Register  to view this content.
    Will delete all data from column A and B, except A1 and B1, but it seems that is not true.

    Can you give some code that will delete all data from column A and B, except A1 and B1 ?

    Thank you for your time!
    Attached Files Attached Files

  17. #17
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    By not stating what you want initially & finally adding a workbook that represents your code you are making our task of providing a solution much more difficult. If you don't ask your question in a concise way with the correct requirements you will find that you won't get answers!

    Please Login or Register  to view this content.

  18. #18
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    By not stating what you want initially & finally adding a workbook that represents your code you are making our task of providing a solution much more difficult. If you don't ask your question in a concise way with the correct requirements you will find that you won't get answers!

    Please Login or Register  to view this content.
    The same problem, this code will delete range A1 and B1 from sheet1. Range A1= "Item" and range "B1"="quantity", I need this data! I need row 1 from sheet1 to be the same all the time. I need the copied values in sheet1 starting with row2.


    Belive me that I had tried to be as concise as possible, but my english is not helping me all the time.
    Please read my first post from this thread, I had tried to say that I need to copy :
    -from sheet2- column C and D, from row 3 to the end
    -to sheet1 - column A and B, starting with row 2
    after that I need to create a border to the copied values and I need to create a border to the empty cell from column C (in sheet1)
    Then and now I need the same thing.

    But, I need to copy data from sheet2, only column C and D, starting with row 3 (C3:D3,C4:D4,C5:D5 .. to the end). Also I need data from sheet1, Range A1 and B1 unaltered.

    Sorry one more time for my english, and thank you for your patience!
    Attached Files Attached Files

  19. #19
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    It doesn't delete A1 & B1 for me. It's still not clear what you want, are you wanting to delete the existing data on sheet1 before adding data from sheet2?

  20. #20
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    It will delete the headers if you have no other data in column B of sheet1.
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    It doesn't delete A1 & B1 for me. It's still not clear what you want, are you wanting to delete the existing data on sheet1 before adding data from sheet2?
    Please open attached file and run the code!
    Before runing the code in sheet1:
    Please Login or Register  to view this content.
    After runing the code in sheet1:
    Please Login or Register  to view this content.

    Range A1 and B1 from sheet1 has been deleted! I don't want that! I need this range the same all the time.

    I want to delete only data from A2:B2,A3:B3,A4:B4 ..etc. from sheet1 before adding data from sheet2, beacause the data from sheet 2 will not be the same all the time.

    I am using office 2003!
    Attached Files Attached Files

  22. #22
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    See my last post

  23. #23
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    It will delete the headers if you have no other data in column B of sheet1.
    Please Login or Register  to view this content.
    This it's what I was looking for!
    But, I would like a little improvement if is possible.
    If I modify the number of rows to copy (sheet2), let's say, from 24 to 11 and I run one more time the code I will have in sheet 1 some blank cell with border. I don't want that!.
    Please open attached file!
    Attached Files Attached Files

  24. #24
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    Hopefully this is right
    Please Login or Register  to view this content.

  25. #25
    Forum Contributor iscar_marius's Avatar
    Join Date
    12-19-2008
    Location
    germany
    MS-Off Ver
    2000 and 2003
    Posts
    221

    Re: copy range in another sheet and create border

    Quote Originally Posted by royUK View Post
    Hopefully this is right
    Please Login or Register  to view this content.
    Thank you for all your help!
    Thread solved

  26. #26
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copy range in another sheet and create border

    If you are satisfied with the solution(s) provided, please mark your thread as Solved and use the scales icon to rate the answer(s).

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1