for each cell

J

Jak

As you know excel does not paste as value when the cells
are selected with the control button in different parts of
the sheet. What I would like to do is to write a macro so
that
For each cell in selection
do the paste special for each cell
next cell

Can anyone help me with the systax of the above. I just
wrote what I needed excel to do.

Thanks
 
C

Cecilkumara Fernando

Jak
try
Sub Macro4()
Dim cell As Range
For Each cell In Selection
cell.Copy
cell.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next
End Sub

Cecil
 
D

Dave Peterson

But it does work if you do it area by area:

Option Explicit
Sub testme()

Dim myArea As Range

For Each myArea In Selection.Areas
With myArea
.Value = .Value
End With
Next myArea

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top