ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   assigning formula to a target column (https://www.excelbanter.com/excel-programming/338748-assigning-formula-target-column.html)

ALEX

assigning formula to a target column
 
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

Tom Ogilvy

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





All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com