Multiple Target as Excel Range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Excel 97, I need to use the following behind a worksheet but need
to incl,ude the following blocks of cells in the range.

It works with 2 but debugs on 3.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'Sets the range of cells for the code to work if a cell other than the range
is altered
'the sub is exited.
Set Target = Intersect(Target, Range("C11:AD15", "C19:AD23", "C27:P31"))
If Target Is Nothing Then
Exit Sub
End If

Can anyone assist with a solution, please?

Many thanks
 
Mark,

Try this

Set myRng= Intersect(Target, Union(Range("C11:AD15"), _
Range("C19:AD23"), Range("C27:P31")
If myRng Is Nothing


re-using Target just doesn't seem right to me, you would be discarding
valuable information

--

HTH

RP
(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