_Change() to filter data in a worksheet from userform
I have userform that I am using to take a bunch of data. I also want to function as a way to query past data. I have it set up to pull a graph from the worksheet and display as an image in the form. It updates every time the user changes a listbox with a _change().
What I need to learn is how to filter the WS from the listbox selection and then regraph the data right before I pull the graph the image.
Thanks for any suggestions!
ThugDragon
p.s. using excel 2002
Re: _Change() to filter data in a worksheet from userform
try recording a macro of filtering the data, to generate some sample code
Re: _Change() to filter data in a worksheet from userform
Welcome to VBForums :wave:
Thread moved to 'Office Development/VBA' forum... note that while it certainly isn't made clear, the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt
Re: _Change() to filter data in a worksheet from userform
Thansk for the tip for doing a macro!
Here is the code I recieve from recording the macro (however I'm doing this at home in excel 2007) where as at work it must work on 2002.
Column A was a number, column B was a date (is that why it uses 'Operator:=' and 'Criteria2:=' ?)
Sub Macro3()
'
' Macro3 Macro
' Select from both autofilters column a&b
'
'
ActiveSheet.Range("$A$1:$B$12").AutoFilter Field:=1, Criteria1:="3"
ActiveSheet.Range("$A$1:$B$12").AutoFilter Field:=2, Operator:= _
xlFilterValues, Criteria2:=Array(2, "2/2/1990")
End Sub
So... if I put a 'listboxentry1.value' in place of "3" that line should work inserted into a _change()?
Thanks,
ThugDragon
Re: _Change() to filter data in a worksheet from userform
Quote:
So... if I put a 'listboxentry1.value' in place of "3" that line should work inserted into a _change()?
i think that should be right, try it and see