+ Reply to Thread
Results 1 to 22 of 22

remove the cell selection border after copying cell

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    remove the cell selection border after copying cell

    hello... i have a code below which works perfectly copying the contents in rage B4 to C4 to the email body but I need to remove the cells copy selection border from being shown in the excel sheet after copying the cells . Also, how can I control the row selection in this code? I think I need to change the xlDown to let say stop the selection at B30 and C30

    any chance you can help me out guys? thanks in advance!

    Please Login or Register  to view this content.
    Last edited by michibahn; 05-14-2015 at 03:53 PM.

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    Here is how to stop the copy selection border:
    Please Login or Register  to view this content.
    The rest I don't know about.

  3. #3
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by nigelbloomy View Post
    Here is how to stop the copy selection border:
    Please Login or Register  to view this content.
    The rest I don't know about.
    thanks so much nigel! just need to know how to control the row selection because it copies infinitely downwards

  4. #4
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    I have used this link to find the last row: (I hope it is OK to lead people to results in other forums.)
    http://stackoverflow.com/questions/1...ed-cell-in-vba
    It is basically using xlUp instead of xlDown. For some reason that changes the results sometimes.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by nigelbloomy View Post
    I have used this link to find the last row: (I hope it is OK to lead people to results in other forums.)
    http://stackoverflow.com/questions/1...ed-cell-in-vba
    It is basically using xlUp instead of xlDown. For some reason that changes the results sometimes.
    Please Login or Register  to view this content.
    would you mind showing how to integrate the xlUp in code? I would like to just copy cells starting from B4 to C4 and ends to B30 to C30. thanks again!

  6. #6
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    You can hard code that in by using this. As long as the cells don't change very often this would work.

    Change
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by nigelbloomy View Post
    You can hard code that in by using this. As long as the cells don't change very often this would work.

    Change
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.
    thank you so much! that did the trick

  8. #8
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    hey nigel.. just need another favor if you don't mind.. how do I put a range to capture the email addresses on cells B1 up to B20? currently the code below on gets the address on B1. thanks again!

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by nigelbloomy View Post
    Please Login or Register  to view this content.
    I actually tried that before I post it here but didn't work. I get an "automation error"

  11. #11
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    You have to create the string for the To field by looping through your list. I think this would work for you.

    Please Login or Register  to view this content.

  12. #12
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    Sorry, I forgot that you should declare Cell as a range. Also, the first time through the loop, stTo is empty so you need to add another line to clean out that first 2 semicolons.

    Please Login or Register  to view this content.
    Last edited by nigelbloomy; 05-15-2015 at 11:02 AM.

  13. #13
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    This actually works better for the loop because it makes sure to skip any blanks. You also don't need the line stTo = Mid(stTo,3) because now there is nothing to trim.

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    thanks nigel.. i had to add a space on the email address in B1 since it removes the first letter of the email is there a fix for this?

  15. #15
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by michibahn View Post
    thanks nigel.. i had to add a space on the email address in B1 since it removes the first letter of the email is there a fix for this?
    disregard my message above.. your second code fixed it! thanks a lot!

  16. #16
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    What is your code now? Sorry, I made so many corrections that I am not sure what your code looks like now.

    Never mind. Glad that last part fixed it.

  17. #17
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by nigelbloomy View Post
    What is your code now? Sorry, I made so many corrections that I am not sure what your code looks like now.

    Never mind. Glad that last part fixed it.

    don't be sorry everything is fine with the code. I just had to move the Application.CutCopyMode = False below the SendKeys to clear the cell selection box thanks so much for your help
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    ok i found a little bug in the code.. i have to run the macro twice for the selection to be pasted on the email body. the first run will not paste the selection. if i remove the Application.CutCopyMode = False code, it will work the first time but i need that code to remove the selection border in the sheet. looks like i need to put a delay on this entry for it to wait before it selection gets pasted?

    by the way i have a realtime running clock macro also in the sheet. not sure if it affecting this issue..

    Please Login or Register  to view this content.
    Last edited by michibahn; 05-15-2015 at 02:41 PM.

  19. #19
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    I tested this code out and it seems to work. It uses a subroutine called RangetoHTML.

    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    I tried the code but it doesn't paste the pictures and charts to the email body

  21. #21
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: remove the cell selection border after copying cell

    You might need to start a new thread on how to paste everythng into an email body using sendkeys. You have passed my limit on VBA knowledge, but I know there are lots of others on here who would be able to help. I found the post you used to get the original code, but I have the same problem as you, the body part of the email is not selected when the sendkeys code is trying to paste everything. It looks like there is a way to do this using word as the editor, but I couldn't understand how to make it work.

  22. #22
    Registered User
    Join Date
    11-12-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: remove the cell selection border after copying cell

    Quote Originally Posted by nigelbloomy View Post
    You might need to start a new thread on how to paste everythng into an email body using sendkeys. You have passed my limit on VBA knowledge, but I know there are lots of others on here who would be able to help. I found the post you used to get the original code, but I have the same problem as you, the body part of the email is not selected when the sendkeys code is trying to paste everything. It looks like there is a way to do this using word as the editor, but I couldn't understand how to make it work.
    thanks so much nigel for all the efforts... i'm playing around with the code as well and trying to make it work thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy and paste Excel range as picture into Outlook email body using excel vba
    By ExcelDoc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2016, 09:29 PM
  2. Copy and paste text and a chart into Html Email body
    By rpinxt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2014, 09:22 AM
  3. Help with Copy Range from Tab and Paste In Outlook Email Message Body.
    By N4VBA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2014, 03:40 PM
  4. Is there a way to Copy And Paste Excel Range As Picture Into Outlook Email Body Using Exc
    By dineshsachidananda in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2014, 09:00 AM
  5. [SOLVED] Vba code copy range and paste special in email body
    By Webman1012 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2013, 12:48 PM

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