View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA Autofilter nightmare

You need a line continuation character in the filter command:

Private Sub cboAccountNumber_Change()
Sheets("PG&E").Select
Range("ListPGE").Select
Selection.AutoFilter Field:=1, _
Criteria1:=frmECR.cboAccountNumber.Text
End Sub

either that or put it all on one line.

--
Regards,
Tom Ogilvy


Jmbostock wrote in message
...
Still doesn't work. I cut the code down to the bare minimun just in case
something was effecting it that i didn't count on.

The userform initializes Then I click on the cbovendor and select one
of three items from a list, one of them being "PG&E".


Private Sub cboVendor_Change()
If frmECR.cboVendor.Text = "PG&E" Then
frmECR.cboAccountNumber.RowSource = "PGEAccount"
End If
End Sub

I then click on the cboAccountnumber, where it gives me a list of
account numbers. I select an account number and the following code
runs.

Private Sub cboAccountNumber_Change()
Sheets("PG&E").Select
Range("ListPGE").Select
Selection.AutoFilter Field:=1,
Criteria1:=frmECR.cboAccountNumber.Text
End Sub

This isn't the code it was previously, i instead recorded a macro and
copied it it, but it still didn't work.

any ideas???


---
Message posted from http://www.ExcelForum.com/