#1   Report Post  
Todd Nelson
 
Posts: n/a
Default Need help w/ formula

Is there a formula that will change another cells information w/o having a
formula in that particular cell. For instance, the IF(N5=Removed" then J5=0)
without putting a formula in j5?
  #2   Report Post  
Duke Carey
 
Posts: n/a
Default

No. A cell formula cannot change another cell.

You can write code to react to value changes in cell N5 and the *code* can
change the value in J5


"Todd Nelson" wrote:

Is there a formula that will change another cells information w/o having a
formula in that particular cell. For instance, the IF(N5=Removed" then J5=0)
without putting a formula in j5?

  #3   Report Post  
Zack Barresse
 
Posts: n/a
Default

No, you cannot affect another cell with worksheet formulas. For that you
would need VBA (Visual Basic for Applications).

If you right click your sheet tab and select View Code, then paste this in
there, it may work for you ...


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("N5").Value = "Removed" Then Range("J5").Value = 0
End Sub


HTH

--
Regards,
Zack Barresse, aka firefytr


"Todd Nelson" wrote in message
...
Is there a formula that will change another cells information w/o having a
formula in that particular cell. For instance, the IF(N5=Removed" then
J5=0)
without putting a formula in j5?



  #4   Report Post  
Todd Nelson
 
Posts: n/a
Default

How?? If N5=removed, j5=0, is what i need it to state

"Duke Carey" wrote:

No. A cell formula cannot change another cell.

You can write code to react to value changes in cell N5 and the *code* can
change the value in J5


"Todd Nelson" wrote:

Is there a formula that will change another cells information w/o having a
formula in that particular cell. For instance, the IF(N5=Removed" then J5=0)
without putting a formula in j5?

  #5   Report Post  
Todd Nelson
 
Posts: n/a
Default

That works! Now....is there a way to do a complete column??

"Zack Barresse" wrote:

No, you cannot affect another cell with worksheet formulas. For that you
would need VBA (Visual Basic for Applications).

If you right click your sheet tab and select View Code, then paste this in
there, it may work for you ...


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("N5").Value = "Removed" Then Range("J5").Value = 0
End Sub


HTH

--
Regards,
Zack Barresse, aka firefytr


"Todd Nelson" wrote in message
...
Is there a formula that will change another cells information w/o having a
formula in that particular cell. For instance, the IF(N5=Removed" then
J5=0)
without putting a formula in j5?






  #6   Report Post  
Zack Barresse
 
Posts: n/a
Default

Yes ...


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
'Only one cell
If Target.Cell.Count 1 then Exit Sub
'Only column N
If Intersect(Target, Range("N:N")) Is Nothing Then Exit Sub
'Work on entire column, changing same row column J value
If Target.Value = "Removed" Then Cells(Target.Row, "J").Value = 0
End Sub


You can set the range to anything desired actually.

--
Regards,
Zack Barresse, aka firefytr


"Todd Nelson" wrote in message
...
That works! Now....is there a way to do a complete column??

"Zack Barresse" wrote:

No, you cannot affect another cell with worksheet formulas. For that you
would need VBA (Visual Basic for Applications).

If you right click your sheet tab and select View Code, then paste this
in
there, it may work for you ...


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("N5").Value = "Removed" Then Range("J5").Value = 0
End Sub


HTH

--
Regards,
Zack Barresse, aka firefytr


"Todd Nelson" wrote in message
...
Is there a formula that will change another cells information w/o
having a
formula in that particular cell. For instance, the IF(N5=Removed" then
J5=0)
without putting a formula in j5?






  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just a typo alert.

You have "target.cell.count". You meant "target.cells.count".

But if you're changing something in a worksheet_change event, it's usually best
to disable events while you do your change. Then the change you code makes
doesn't cause the event to fire again.

Your routine slightly modified:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

'Only one cell
If Target.Cells.Count 1 Then Exit Sub

'Only column N
If Intersect(Target, Me.Range("N:N")) Is Nothing Then Exit Sub

On Error GoTo errHandler:

'Work on entire column, changing same row column J value
If LCase(Target.Value) = LCase("Removed") Then
Application.EnableEvents = False
Me.Cells(Target.Row, "J").Value = 0
End If

errHandler:
Application.EnableEvents = True
End Sub

(I also changed target.value to lcase(target.value)--just in case the user types
removed or REMOVED or some variation.)

Zack Barresse wrote:

Yes ...

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
'Only one cell
If Target.Cell.Count 1 then Exit Sub
'Only column N
If Intersect(Target, Range("N:N")) Is Nothing Then Exit Sub
'Work on entire column, changing same row column J value
If Target.Value = "Removed" Then Cells(Target.Row, "J").Value = 0
End Sub

You can set the range to anything desired actually.

--
Regards,
Zack Barresse, aka firefytr

"Todd Nelson" wrote in message
...
That works! Now....is there a way to do a complete column??

"Zack Barresse" wrote:

No, you cannot affect another cell with worksheet formulas. For that you
would need VBA (Visual Basic for Applications).

If you right click your sheet tab and select View Code, then paste this
in
there, it may work for you ...


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("N5").Value = "Removed" Then Range("J5").Value = 0
End Sub


HTH

--
Regards,
Zack Barresse, aka firefytr


"Todd Nelson" wrote in message
...
Is there a formula that will change another cells information w/o
having a
formula in that particular cell. For instance, the IF(N5=Removed" then
J5=0)
without putting a formula in j5?




--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
referencing named formula using INDIRECT function [email protected] Excel Worksheet Functions 19 May 11th 05 09:48 AM
Simplify formula Luke Excel Worksheet Functions 37 May 6th 05 07:21 AM
put formula results into a different cell if it is empty PutFormula Excel Worksheet Functions 2 February 11th 05 03:31 AM
how do i write a formula and keep in in formula form, so it DOESN. norcalchick2207 Excel Discussion (Misc queries) 2 February 4th 05 08:38 PM
Match / Vlookup within an Array formula Hari Prasadh Excel Discussion (Misc queries) 3 February 3rd 05 04:37 PM


All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"