View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Data Validation If statement moved to userform

Untested

Private Sub Combobox1_Click()
Worksheets("Places").Range("G2").Calculate
Worksheets("Places").Range("PlacesDatabase") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Places").Range("G1:G2"), _
CopyToRange:=Range("B40:C40"), Unique:=False
End Sub

but I don't see where cell C3 comes into play?

--
HTH

Bob Phillips

"thom hoyle" wrote in message
...
I currently have a worksheet that uses a Data validation List called
"counties". When the user selects a "county" the following code runs on

the
sheet.
'(Target.Row/Column is C3, on countyselect sheet)

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 3 And Target.Column = 3 Then
'calculate criteria cell in case calculation mode is manual
Worksheets("Places").Range("G2").Calculate
Worksheets("Places").Range("PlacesDatabase") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Places").Range("G1:G2"), _
CopyToRange:=Range("B40:C40"), Unique:=False
End If
End Sub

I used the code from one of contexures.com files.
It populates the current sheet at location B40 with information from

another
sheet called ("Places") Based on which county the users selected.

My Goal is to put this onto the userform I have in the workbook. Thus far

I
have created the combobox on the userform, and I used the Rowsource
properties to populate the combobox. Counties!A1:A25 (a sheet with the
listings).

I have moved part of the code over to the userform combobox, but of course
nothing happens for me. I don't program alot in vba, but use examples of

code
to achive my task.
How do I get the combobox to do the same thing that is taking place on the
worksheet when "C3" is changed.

Private Sub cboCountySelect_Change()

End Sub

Thanks very much, I appreciate your efforts in helping me.
thom