View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default how to give values to non-continguous cells simultaneously

you can try this

Sub copy_column()
With Columns("A")
Columns("B").Value = .Value
End With

End Sub


--


Gary


"xiang" wrote in message
...

what I tried to do is very simple: I'd like to let columnB has same
values at same position at column A.

column A columnB
1 1 row 1
row 2
2 2 row 3
3 3 row 4
row 5
4 4 row 6

I got a problem when I use the following code to:

columns(1).cells.specialcells(xlcelltypeconstants) .select
selection.offset(,1).value = selection.value

the result turns out to be somthing like:
1 1 row 1
row 2
2 1 row 3
3 1 row 4
row 5
4 1 row 6

I know I can do that with a loop through each cell in selection area in
column A.

I just wondering whether there is a non-loop way to give the values to
column B
simultaneously.

any help will be appreciated


--
xiang
------------------------------------------------------------------------
xiang's Profile:
http://www.excelforum.com/member.php...o&userid=29489
View this thread: http://www.excelforum.com/showthread...hreadid=492594