ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   for each cell (https://www.excelbanter.com/excel-programming/274710-each-cell.html)

Jak[_2_]

for each cell
 
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

Cecilkumara Fernando

for each cell
 
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

"Jak" wrote in message
...
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




Dave Peterson[_3_]

for each cell
 
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


Jak wrote:

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


--

Dave Peterson



All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com