Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Want entry in column 16 to clear if value in column 12 is = to 10
When entry is made into column 12 as target calls sub pledge following. If target.column = 12 And target.Value = 10 And IsNumeric(target.Value) Then _ Call Pledge(target) Public Sub Pledge(ByVal target As range) Sheets("data").Select target("column = 16").ClearContents End Sub Know I am missing something all entries in same row and will apply thru complete sheet. Reason I believe (target) keeps column row relationship. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can put this in the sheet code module by right clicking the sheet tab
then select View Code from the pop up menu and paste this into the window: Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Long lr = Cells(Rows.Count, 12).End(xlUp).Row If Not Intersect(Target, Range("L2:L" & lr) Is Nothing Then If IsNumeric(Target.Value) And Target.Vaue = 10 Then Sheets("data").Range("P" & Target.Row).ClearContents End If End If End Sub This eliminates the need to call the othe macro. If the criteria is met, it goes directly to the sheet and deletes clears the range in column 16 for the same row as the target in column 12. Let me know if you get an error and what the error message says. "Curt" wrote in message ... Want entry in column 16 to clear if value in column 12 is = to 10 When entry is made into column 12 as target calls sub pledge following. If target.column = 12 And target.Value = 10 And IsNumeric(target.Value) Then _ Call Pledge(target) Public Sub Pledge(ByVal target As range) Sheets("data").Select target("column = 16").ClearContents End Sub Know I am missing something all entries in same row and will apply thru complete sheet. Reason I believe (target) keeps column row relationship. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Not Intersect(Target, Range("L2:L" & lr) Is Nothing Then
syntax error tried putting underscore after Then no go "JLGWhiz" wrote: You can put this in the sheet code module by right clicking the sheet tab then select View Code from the pop up menu and paste this into the window: Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Long lr = Cells(Rows.Count, 12).End(xlUp).Row If Not Intersect(Target, Range("L2:L" & lr) Is Nothing Then If IsNumeric(Target.Value) And Target.Vaue = 10 Then Sheets("data").Range("P" & Target.Row).ClearContents End If End If End Sub This eliminates the need to call the othe macro. If the criteria is met, it goes directly to the sheet and deletes clears the range in column 16 for the same row as the target in column 12. Let me know if you get an error and what the error message says. "Curt" wrote in message ... Want entry in column 16 to clear if value in column 12 is = to 10 When entry is made into column 12 as target calls sub pledge following. If target.column = 12 And target.Value = 10 And IsNumeric(target.Value) Then _ Call Pledge(target) Public Sub Pledge(ByVal target As range) Sheets("data").Select target("column = 16").ClearContents End Sub Know I am missing something all entries in same row and will apply thru complete sheet. Reason I believe (target) keeps column row relationship. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
expected list seperator or ) also as error
"JLGWhiz" wrote: You can put this in the sheet code module by right clicking the sheet tab then select View Code from the pop up menu and paste this into the window: Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Long lr = Cells(Rows.Count, 12).End(xlUp).Row If Not Intersect(Target, Range("L2:L" & lr) Is Nothing Then If IsNumeric(Target.Value) And Target.Vaue = 10 Then Sheets("data").Range("P" & Target.Row).ClearContents End If End If End Sub This eliminates the need to call the othe macro. If the criteria is met, it goes directly to the sheet and deletes clears the range in column 16 for the same row as the target in column 12. Let me know if you get an error and what the error message says. "Curt" wrote in message ... Want entry in column 16 to clear if value in column 12 is = to 10 When entry is made into column 12 as target calls sub pledge following. If target.column = 12 And target.Value = 10 And IsNumeric(target.Value) Then _ Call Pledge(target) Public Sub Pledge(ByVal target As range) Sheets("data").Select target("column = 16").ClearContents End Sub Know I am missing something all entries in same row and will apply thru complete sheet. Reason I believe (target) keeps column row relationship. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If Not Intersect(Target, Range("L2:L" & lr) Is Nothing Then
did catch missing ) after Target, Range still didn't clear "p" "JLGWhiz" wrote: You can put this in the sheet code module by right clicking the sheet tab then select View Code from the pop up menu and paste this into the window: Private Sub Worksheet_Change(ByVal Target As Range) Dim lr As Long lr = Cells(Rows.Count, 12).End(xlUp).Row If Not Intersect(Target, Range("L2:L" & lr) Is Nothing Then If IsNumeric(Target.Value) And Target.Vaue = 10 Then Sheets("data").Range("P" & Target.Row).ClearContents End If End If End Sub This eliminates the need to call the othe macro. If the criteria is met, it goes directly to the sheet and deletes clears the range in column 16 for the same row as the target in column 12. Let me know if you get an error and what the error message says. "Curt" wrote in message ... Want entry in column 16 to clear if value in column 12 is = to 10 When entry is made into column 12 as target calls sub pledge following. If target.column = 12 And target.Value = 10 And IsNumeric(target.Value) Then _ Call Pledge(target) Public Sub Pledge(ByVal target As range) Sheets("data").Select target("column = 16").ClearContents End Sub Know I am missing something all entries in same row and will apply thru complete sheet. Reason I believe (target) keeps column row relationship. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Clear Contents | Excel Discussion (Misc queries) | |||
clear contents | Excel Programming | |||
Macro to clear range contents when cell contents are changed by us | Excel Programming | |||
Clear contents | Excel Programming | |||
Clear contents if x is not in the row | Excel Programming |