+ Reply to Thread
Results 1 to 4 of 4

Edit copied cells rather than original cells

  1. #1
    Registered User
    Join Date
    12-17-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    7

    Edit copied cells rather than original cells

    Hi I am trying to do this:

    1) Copy selected cells 10 rows below
    2) Modify copied cells so that percentages become whole numbers and they are highlighted yellow.

    Below is what I have so far. However this code is modifying the original cells, not the copied ones.

    Before the line *For Each cell In r* I need to find a way to make it 'select' the copied cells so that these get modified instead.

    Thanks very much for any help.


    Sub Macro4()


    Dim r As Range
    Set r = Selection
    r.Copy Destination:=r.Offset(10, 0)

    For Each cell In r
    With cell
    If Application.WorksheetFunction.IsNumber(cell) Then
    .Value = .Value * 100
    .NumberFormat = "0"
    .Interior.Color = RGB(255, 255, 0)
    End If
    End With
    Next cell

    End Sub

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Edit copied cells rather than original cells

    Please use code tags when posting.

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-17-2014
    Location
    London
    MS-Off Ver
    2007
    Posts
    7

    Re: Edit copied cells rather than original cells

    Quote Originally Posted by JOHN H. DAVIS View Post
    Please use code tags when posting.

    Maybe:

    Please Login or Register  to view this content.
    Thanks that's great

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Edit copied cells rather than original cells

    You're welcome. Glad to help out and thanks for the feedback. Please comply with the Forum Rules and mark this thread as solved.

    http://www.excelforum.com/forum-rule...rum-rules.html

+ 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. Replies: 3
    Last Post: 07-26-2014, 06:12 AM
  2. Replies: 1
    Last Post: 03-29-2014, 09:56 AM
  3. [SOLVED] edit a macro that will limit the range of cells being copied in the email body
    By melody10 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-16-2013, 10:45 AM
  4. [SOLVED] Copy Entire column and then insert the copied cells below the original
    By awagenhurst in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-18-2013, 04:52 PM
  5. making copied cells change with change in original cell
    By Jennifer Mcdermeit in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-20-2006, 11:58 AM

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