Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
I found a vb program and modified it to work on my spreadsheet. It's
activated based on cell a1. I copied it again and changed it to activate on g1. a1 gives me customers and g1 gives me the customers by the designated month. Both work individually but not pasted in the same book. I'm a pure rookie. Any suggestions? Thanks, Greg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
Greg,
Post the code and we might have a chance of helping you. Robin Hammond www.enhanceddatasystems.com "Greg" wrote in message ... I found a vb program and modified it to work on my spreadsheet. It's activated based on cell a1. I copied it again and changed it to activate on g1. a1 gives me customers and g1 gives me the customers by the designated month. Both work individually but not pasted in the same book. I'm a pure rookie. Any suggestions? Thanks, Greg |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
Greg Can we see the code you are using? And what are you trying to do -- Nori ----------------------------------------------------------------------- Norie's Profile: http://www.excelforum.com/member.php...fo&userid=1936 View this thread: http://www.excelforum.com/showthread.php?threadid=38026 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
Greg Wrote: I found a vb program and modified it to work on my spreadsheet. It's activated based on cell a1. I copied it again and changed it to activate on g1. a1 gives me customers and g1 gives me the customers by the designated month. Both work individually but not pasted in the same book. I'm a pure rookie. Any suggestions? Thanks, Greg Greg, If you copied and pasted it, They both probably have the same name, which you can't use together. If so, just change the name of the second macro, then you can use them in the same book. Dave -- Piranha ------------------------------------------------------------------------ Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435 View this thread: http://www.excelforum.com/showthread...hreadid=380266 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
here is the script:
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Long If Target.Count 1 Then Exit Sub If Target.Address = "$C$16" Then If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData End If r = Cells(Rows.Count, 1).End(xlUp).Row If Target.Value = Sheets("Lists").Range("A1").Value Then Sheets("Lists").Range("C2").Value = "" Else Sheets("Lists").Range("C2").Value = Target.Value End If Range("a20:P" & r).AdvancedFilter Action:=xlFilterInPlace, _ CriteriaRange:=Sheets("Lists").Range("C1:C2"), Unique:=False End If End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Long If Target.Count 1 Then Exit Sub If Target.Address = "$G$16" Then If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData End If r = Cells(Rows.Count, 1).End(xlUp).Row If Target.Value = Sheets("Lists").Range("D1").Value Then Sheets("Lists").Range("E2").Value = "" Else Sheets("Lists").Range("E2").Value = Target.Value End If Range("a20:P" & r).AdvancedFilter Action:=xlFilterInPlace, _ CriteriaRange:=Sheets("Lists").Range("f1:f2"), Unique:=False End If End Sub thanks, greg "Greg" wrote: I found a vb program and modified it to work on my spreadsheet. It's activated based on cell a1. I copied it again and changed it to activate on g1. a1 gives me customers and g1 gives me the customers by the designated month. Both work individually but not pasted in the same book. I'm a pure rookie. Any suggestions? Thanks, Greg |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
Greg You can't have 2 change events like that for the same worksheet. You could combine that code. Code: -------------------- Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Long If Target.Count 1 Then Exit Sub If Target.Address = "$C$16" Then If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData End If r = Cells(Rows.Count, 1).End(xlUp).Row If Target.Value = Sheets("Lists").Range("A1").Value Then Sheets("Lists").Range("C2").Value = "" Else Sheets("Lists").Range("C2").Value = Target.Value End If Range("a20:P" & r).AdvancedFilter Action:=xlFilterInPlace, _ CriteriaRange:=Sheets("Lists").Range("C1:C2"), Unique:=False End If If Target.Address = "$G$16" Then If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData End If r = Cells(Rows.Count, 1).End(xlUp).Row If Target.Value = Sheets("Lists").Range("D1").Value Then Sheets("Lists").Range("E2").Value = "" Else Sheets("Lists").Range("E2").Value = Target.Value End If Range("a20:P" & r).AdvancedFilter Action:=xlFilterInPlace, _ CriteriaRange:=Sheets("Lists").Range("f1:f2"), Unique:=False End If End Sub -------------------- -- Norie ------------------------------------------------------------------------ Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362 View this thread: http://www.excelforum.com/showthread...hreadid=380266 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb dummy - two routines
Norie,
Perfect! Thanks....Greg "Norie" wrote: Greg You can't have 2 change events like that for the same worksheet. You could combine that code. Code: -------------------- Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Long If Target.Count 1 Then Exit Sub If Target.Address = "$C$16" Then If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData End If r = Cells(Rows.Count, 1).End(xlUp).Row If Target.Value = Sheets("Lists").Range("A1").Value Then Sheets("Lists").Range("C2").Value = "" Else Sheets("Lists").Range("C2").Value = Target.Value End If Range("a20:P" & r).AdvancedFilter Action:=xlFilterInPlace, _ CriteriaRange:=Sheets("Lists").Range("C1:C2"), Unique:=False End If If Target.Address = "$G$16" Then If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData End If r = Cells(Rows.Count, 1).End(xlUp).Row If Target.Value = Sheets("Lists").Range("D1").Value Then Sheets("Lists").Range("E2").Value = "" Else Sheets("Lists").Range("E2").Value = Target.Value End If Range("a20:P" & r).AdvancedFilter Action:=xlFilterInPlace, _ CriteriaRange:=Sheets("Lists").Range("f1:f2"), Unique:=False End If End Sub -------------------- -- Norie ------------------------------------------------------------------------ Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362 View this thread: http://www.excelforum.com/showthread...hreadid=380266 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel VBA Wookbook Routines | Excel Discussion (Misc queries) | |||
VBA - sub routines Help please | New Users to Excel | |||
VBA routines - help please | Excel Discussion (Misc queries) | |||
Removing VBA routines | Excel Programming | |||
api call routines | Excel Programming |