Macro Error

B

Bob Vance

This macro copies from 2 cells A150, C152 then lists them on sheet "Two" in
A & B Column, but I am getting a error on the Union line, "Cant copy from
multiple cells"

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address = "$C$152" Then
With Sheets("Two")
If .[A1] = "" Then
Union([A150], [C152]).Copy .[A1]
Else
Union([A150], [C152]).Copy .Range("A" & Rows.Count). _
End(xlUp)(2)
End If
[A1].Select
End With
End If
End Sub
--
Thanks in advance for your help....Bob Vance
..
..
..
..
 
H

Harlan Grove

Bob Vance said:
This macro copies from 2 cells A150, C152 then lists them on sheet "Two" in
A & B Column, but I am getting a error on the Union line, "Cant copy from
multiple cells" ....
Union([A150], [C152]).Copy .[A1]
....

I don't believe you can ever do this. Select two nonadjacent cells in any
worksheet and try to run the menu command Edit > Copy. Excel 2000 throws
errors when I try to do this interactively. It wouldn't be surprising if
Excel also didn't allow macros to do this.
 
P

Peo Sjoblom

Harlan Grove said:
Bob Vance said:
This macro copies from 2 cells A150, C152 then lists them on sheet "Two" in
A & B Column, but I am getting a error on the Union line, "Cant copy from
multiple cells" ...
Union([A150], [C152]).Copy .[A1]
...

I don't believe you can ever do this. Select two nonadjacent cells in any
worksheet and try to run the menu command Edit > Copy. Excel 2000 throws
errors when I try to do this interactively. It wouldn't be surprising if
Excel also didn't allow macros to do this.



I believe you can if the cells are either in the same column or the same
row. i.e.

Union([A150], [IV150]).Copy .[A1]

should work.


Regards,

Peo Sjoblom
 
H

Harlan Grove

Peo Sjoblom said:
I believe you can if the cells are either in the same column or the same
row. i.e.

Union([A150], [IV150]).Copy .[A1]

should work.

You're right. So much for orthogonality (again).
 
B

Bob Vance

Great put them on the same Row, Thanks

--
Thanks in advance for your help....Bob Vance
..
..
..
..

Harlan Grove said:
Peo Sjoblom said:
I believe you can if the cells are either in the same column or the same
row. i.e.

Union([A150], [IV150]).Copy .[A1]

should work.

You're right. So much for orthogonality (again).
 

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