perform multiple actions in an IF
current cell was the cell that the 'if' statement was in
i think your option may be the best way to go
last time i used the Worksheet_Change(ByVal Target as Range)
and checking for target being in column 1, and from rows 1 to 20
and then setting the values of the cells i wanted based on that
"Patrick Molloy" wrote:
by "current cell" I assume you mean the currently selected cell.
Try the following code:
Option Explicit
Sub Test()
SetCells Range("A1")
End Sub
Sub SetCells(source As Range)
Select Case True
Case source.Value = ""
source.Offset(0, 1) = 0
source.Offset(0, 2) = 0
Selection = ""
Case IsNumeric(source.Value)
source.Offset(0, 1) = 1
source.Offset(0, 2) = 1
Selection = source.Value + 1
Case Else
End Select
End Sub
"Gixxer_J_97" wrote:
hi all
is there a way to perform multiple actions in an IF statement
ie
=IF(ISBLANK(A1),<set current cell value = "";<set Cell B1 value = 0;<set
Cell C1 value = 0,<set Current cell value = A1+1;<set cell b1 value =
1;<set cell c1 value = 1)
if A1 is blank, then the current cell is 'blank', B1 contains 0, C1 contains 0
else current cell =A1+1, B1 contains 1, C1 contains 1
if that is not possible, is it possible to set the value of another cell to
a certain value (other than the one the formula is in).
tia
J
|