View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default assigning formula to a target column

If Target.Columns.count 1 then exit sub
If Target.Column < 8 and Target.Column < 1 then exit sub

After that, there should be no difference

--
Regards,
Tom Ogilvy

"Alex" wrote in message
...
When I have only one target column it's working well:

If (Target.Column < 8) Then Exit Sub
If Target.Cells.Count 8 Then Exit Sub
Application.EnableEvents = False

With Target(1, 3)
If Target.Value < "" Then
.NumberFormat = "mmm-yy"
.FormulaR1C1 = "=RC[-2]"
Else
.ClearContents
End If
End With

With Target(1, 4)
If Target.Value < "" Then
...
End With

But, when I'm trying to use one more (the first) target column it's not
working:
If (Target.Column < 8) Or (Target.Column < 1) Then Exit Sub 'here it

goes
to exit
If Target.Cells.Count 8 Then Exit Sub ' don't know how to handle with

this
as well
Application.EnableEvents = False
...

How could I do it?

Thanks
'If Target.Column = 8 Then