Excel Range problem?

A

amitkr

Hi..

What happens when i do a drag and drop operation...?

To the worksheet change event( as I can see) the range that is passe


is the source (from wer we dragged) and the target wer we dropped..

Any way to get the address of the range wer i dropped..I dun need th
source address...

Any help will be much appreciated.

Than
 
V

Vasant Nanavati

Use the SelectionChange event.

Target.Address

will give you the address of the range where you dropped the selection.
 
A

amitkr

Thanx for the response

But it's not solving my problem



I don't know why but for every drag and drop operation this procedur
is called twice

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

I tried target.address

when the function is called the first time it gave the address of th
source ...

and second time it gave me the target cells adress.

Anyway to get only the target address...i cant apply a logic lik
bypass the function the first time and read the value next time coz i
will spoil the rest of program thank
 
M

mangesh_yadav

Hi,

As Vasant has pointed out, you could use
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
instead of
Private Sub Worksheet_Change(ByVal Target As Range)

This eliminates your problem. But incase you have something else i
your code, which you feel will not be executed with the SelectionChang
event, then you might post your code. But as I see it, this should solv
your problem

- Manges
 

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