Noob question - Worksheet_Change

  • Thread starter Thread starter Rich Wallace
  • Start date Start date
R

Rich Wallace

Hi all,

I am running some code against the Worksheet_Change event that picks out the
target.value and writes the output to XML. What I've noticed lately is,
if/when a user performs a copy from one cell, and pastes the value to
another cell or a range of cells, my Worksheet_Change event fires, but does
not trap the target.value from the first cell that is populated nor does it
run for every cell that had new data pasted to it.

Can someone point me in the right direction to code for this? If they paste
one value to five cells, I need to extract the new value from each
individual cell it was pasted to.

Thanks!
-Rich
 
Rich,

If Target is more than one cell, you have to trap that (Target.Count >1),
and process each cell in that range

For Each cell In Target
'etc
Next cell

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks Bob,

The code is running as you suggested, but when I loop on the cell, my
Target.Row value is not reflecting the new value so I loop on the same cell
as many times as there are cells in the range.

Any ideas?

Thangs again,
-Rich
 
Rich,

In your code you don't deal with Target any more. The object that you
process now becomes cell (or whatever else you call it)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Back
Top