Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am missing something and am stumped. Have the following code in the
workbook I want it to run when an entry is made in column 'J' or '10' reference Then subtract 10.00 amd take the remaining amount and place this and other data in row in columns 'E F G H I' into donors worksheet. This is my first attempt at this event happening. Anyway here is code Any takers? Thanks Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal target As Range) Select Case Sh.Name Case "Data", "Motorcycle", "Indian", "Native" '1=Data 6=Motorcycle 7=Indian 8=Native If target.Column = 10 And target.Value 10 Then Call _ CopyStuff(target) End Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Your explanation was not clear to me. I've found that if you can describe exactly what you want to do then writing the code becomes much easier. Here is my interpretation. The code goes in the ThisWorkbook module. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware Private Sub Workbook_SheetChange(ByVal Sh As Object, _ ByVal Target As Excel.Range) Dim dblValue As Double Dim varTargetAmt As Variant varTargetAmt = Target.Cells(1, 1).Value Select Case Sh.Name Case "Data" If Target.Column = 1 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Motorcycle" If Target.Column = 6 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Indian" If Target.Column = 7 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Native" If Target.Column = 8 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If End Select If dblValue 0 Then Me.Worksheets("doner").Range("E2:I2").Value = _ Array(dblValue, 10, 20, 30, 40) End If End Sub '----------- "Curt" wrote in message I am missing something and am stumped. Have the following code in the workbook I want it to run when an entry is made in column 'J' or '10' reference Then subtract 10.00 amd take the remaining amount and place this and other data in row in columns 'E F G H I' into donors worksheet. This is my first attempt at this event happening. Anyway here is code Any takers? Thanks Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal target As Range) Select Case Sh.Name Case "Data", "Motorcycle", "Indian", "Native" '1=Data 6=Motorcycle 7=Indian 8=Native If target.Column = 10 And target.Value 10 Then Call _ CopyStuff(target) End Select End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
studying your code it would seem I don't need copystuff copying could be done
within the code you wrote? I lack knowledge to understand the last about Doners worksheet in your code. Hope what I sent clears the water Thank you "Jim Cone" wrote: Your explanation was not clear to me. I've found that if you can describe exactly what you want to do then writing the code becomes much easier. Here is my interpretation. The code goes in the ThisWorkbook module. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware Private Sub Workbook_SheetChange(ByVal Sh As Object, _ ByVal Target As Excel.Range) Dim dblValue As Double Dim varTargetAmt As Variant varTargetAmt = Target.Cells(1, 1).Value Select Case Sh.Name Case "Data" If Target.Column = 1 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Motorcycle" If Target.Column = 6 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Indian" If Target.Column = 7 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Native" If Target.Column = 8 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If End Select If dblValue 0 Then Me.Worksheets("doner").Range("E2:I2").Value = _ Array(dblValue, 10, 20, 30, 40) End If End Sub '----------- "Curt" wrote in message I am missing something and am stumped. Have the following code in the workbook I want it to run when an entry is made in column 'J' or '10' reference Then subtract 10.00 amd take the remaining amount and place this and other data in row in columns 'E F G H I' into donors worksheet. This is my first attempt at this event happening. Anyway here is code Any takers? Thanks Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal target As Range) Select Case Sh.Name Case "Data", "Motorcycle", "Indian", "Native" '1=Data 6=Motorcycle 7=Indian 8=Native If target.Column = 10 And target.Value 10 Then Call _ CopyStuff(target) End Select End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
wonderful code put data where wanted but not wanted data. target column on
all sheets is 10 or 'J' we subtract 10.00 from this cell then copy data from cells E-F-G-H-I-J(-10.00)-K To Donors worksheet Column 'J' is formated to currency other cells are data Hope I make sense. Thank You "Jim Cone" wrote: Your explanation was not clear to me. I've found that if you can describe exactly what you want to do then writing the code becomes much easier. Here is my interpretation. The code goes in the ThisWorkbook module. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware Private Sub Workbook_SheetChange(ByVal Sh As Object, _ ByVal Target As Excel.Range) Dim dblValue As Double Dim varTargetAmt As Variant varTargetAmt = Target.Cells(1, 1).Value Select Case Sh.Name Case "Data" If Target.Column = 1 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Motorcycle" If Target.Column = 6 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Indian" If Target.Column = 7 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If Case "Native" If Target.Column = 8 And varTargetAmt 10 Then dblValue = varTargetAmt - 10 End If End Select If dblValue 0 Then Me.Worksheets("doner").Range("E2:I2").Value = _ Array(dblValue, 10, 20, 30, 40) End If End Sub '----------- "Curt" wrote in message I am missing something and am stumped. Have the following code in the workbook I want it to run when an entry is made in column 'J' or '10' reference Then subtract 10.00 amd take the remaining amount and place this and other data in row in columns 'E F G H I' into donors worksheet. This is my first attempt at this event happening. Anyway here is code Any takers? Thanks Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal target As Range) Select Case Sh.Name Case "Data", "Motorcycle", "Indian", "Native" '1=Data 6=Motorcycle 7=Indian 8=Native If target.Column = 10 And target.Value 10 Then Call _ CopyStuff(target) End Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't get Sheet_Change event to fire - please help | Excel Programming | |||
Validation list changes don't fire an event | Excel Programming | |||
Event doesn't fire | Excel Discussion (Misc queries) | |||
Workbook Open Event does not fire | Excel Programming | |||
Event class doesn't fire in embedded VBA | Excel Programming |