title: Running a macro on worksheets with a specified name
body: <p>I am trying to write a macro which pastes over the formulae within certain-named worksheets with their values, thereby making them exportable. I have successfully got the macro to dupe and rename the worksheets, but can't get the copy/paste to run on them as I would like.</p>
  
  <p>Currently my macro copies all visible worksheets except one specified ("Dashboard") and then renames them, replacing " (2)" with "_VARIABLES". So far so good. It is then supposed to overwrite formulae in the newly created worksheets with values; this part does not work.</p>
  
  <p>Here is the entire code:</p>
  
  <pre><code>Private Sub testestssss()
  
  Dim ws As Worksheet
  
  'Copy all visible worksheets except "Dashboard" to the end
  
  For Each ws In Sheets
  
  If ws.Name = "Dashboard" Then
  Else
  If ws.Visible Then ws.Copy after:=Worksheets(Worksheets.Count)
  End If
  
  Next
  
  'Rename all "wk * (2)" sheets to "wk *_VARIABLES"
  
  For Each ws In Sheets
  If ws.Name Like "* (2)" Then
  ws.Name = Replace(ws.Name, " (2)", "_VARIABLES")
  End If
  Next
  
  'Overwrite all "wk *_VARIABLES" formulae with values
  
  For Each ws In Sheets
  If ws.Name Like "*_VARIABLES" Then
  Columns("A:B").Select
  Selection.Copy
  Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
      :=False, Transpose:=False
  End If
  Next
  
  End Sub
  </code></pre>
  
  <p>So all the above works up until the 'overwrite all "wk *_VARIABLES" formulae with values' part. That appears to be ineffective.</p>
  
  <p>Any help will be gratefully appreciated!</p>
  
  <p>Thank you.</p>