ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help (https://www.excelbanter.com/excel-programming/319682-need-help.html)

Geir[_2_]

Need help
 
HI
I have a problem. This Sub dont work. What can be wrong?


Sub cell()
For Each Cells In Range("A1:K120")
cell.Value = cell.Value
Next
End Sub

Bernard Liengme

Need help
 
How do you know it "dont work"
All it does is replace each cell's value by what is already there. That is
to say, it does nothing.
Bernard

"Geir" wrote in message
...
HI
I have a problem. This Sub dont work. What can be wrong?


Sub cell()
For Each Cells In Range("A1:K120")
cell.Value = cell.Value
Next
End Sub




Thomas Ramel

Need help
 
Grüezi Geir

Geir schrieb am 28.12.2004

I have a problem. This Sub dont work. What can be wrong?

Sub cell()
For Each Cells In Range("A1:K120")
cell.Value = cell.Value
Next
End Sub


Try the followiong instead:

Range("A1:K120").Value = Range("A1:K120").Value

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]

Glenn

Need help
 
Two things:

1) Change the name of your subroutine. You're using a reserved name
("cell").
2) Change "For Each Cells..." to "For Each Cell..."


-Glenn Ray



Geir wrote:
HI
I have a problem. This Sub dont work. What can be wrong?


Sub cell()
For Each Cells In Range("A1:K120")
cell.Value = cell.Value
Next
End Sub



Don Guillett[_4_]

Need help
 
Does this give you a hint.

for each cell S

But Thomas gave you a good answer.
--
Don Guillett
SalesAid Software

"Geir" wrote in message
...
HI
I have a problem. This Sub dont work. What can be wrong?


Sub cell()
For Each Cells In Range("A1:K120")
cell.Value = cell.Value
Next
End Sub




Geir[_2_]

Need help
 
Thanks Thomas it works fine.

Geir

"Thomas Ramel" wrote:

Grüezi Geir

Geir schrieb am 28.12.2004

I have a problem. This Sub dont work. What can be wrong?

Sub cell()
For Each Cells In Range("A1:K120")
cell.Value = cell.Value
Next
End Sub


Try the followiong instead:

Range("A1:K120").Value = Range("A1:K120").Value

--
Regards

Thomas Ramel
- MVP for Microsoft-Excel -

[Win XP Pro SP-1 / xl2000 SP-3]



All times are GMT +1. The time now is 04:21 AM.

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