View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Runtime error 1004

I believe you would also get that same error if you put that code in the
selectionchange event. So, assuming that what you're trying to do is prevent
the user from selecting any cell in column B by moving it to column A, try
something like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 2 Then
Application.EnableEvents = False
Target.Offset(0, -1).Select
Application.EnableEvents = True
End If
End Sub

If this is not what you're trying to do, then perhaps post a little bit more
of your code and a little more info on what you're trying to do...



--
Hope that helps.

Vergel Adriano


"clara" wrote:

BUt target in on Column B
--
thank you so much for your help


"JMay" wrote:

sounds like what might happen if you click in Column A.
Taget being assigned A? - and Offset instructing excel to
move one-cell -to-the-LEFT (-1) << which if OFF THE SHEET !!


"clara" wrote:

Hi all,

I got error message "Select method of Range class failed"
from target.offset(0, -1).Select in change event when I try to assign the
target.

Clara
--
thank you so much for your help