+ Reply to Thread
Results 1 to 11 of 11

Copy+Paste Special Single Cell on all sheets

Hybrid View

  1. #1
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Copy+Paste Special Single Cell on all sheets

    As i understood it, it was a different cell each time.
    Please take time to read the forum rules

  2. #2
    Registered User
    Join Date
    11-23-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Copy+Paste Special Single Cell on all sheets

    Quote Originally Posted by Steffen Thomsen View Post
    As i understood it, it was a different cell each time.
    I figured it out using the following:

    Code:

    Sub CopyReplace()

    Dim ws As Worksheet
    For Each ws In Sheets
    If ws.Visible Then ws.Select (False)
    Next

    ActiveCell.Copy
    ActiveCell.PasteSpecial xlValues
    Application.CutCopyMode = False

    End Sub

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Re: Copy+Paste Special Single Cell on all sheets

    EG1, If I'm reading your code right, what it's going to do is 1) Select each sheet, one at a time, then 2) determine which cell is the active cell on that sheet (which may or may not correspond with the active cell on the sheet you started with) and 3) convert that active cell to values.


    You can do it like this. This would run faster, as there's no selecting, no copying, and no pasting, and it will hit the same location as your starting sheet.
    Sub Values()
    Dim sh As Worksheet
    Dim addr As String
    addr = ActiveCell.Address
    For Each sh In ThisWorkbook.Worksheets
    sh.Range(addr).Value = sh.Range(addr).Value
    Next
    End Sub

+ 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