unable to get the currentregion property of the range class

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
586
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
On a Userform when I change a combobox, the value gets entered into a cell
This then runs an Advanced Filter, However I keep getting an error 'unable to get the currentregion property of the range class' when it tries to run the Filter

I know the filter works because it runs fine if I run it manually
VBA Code:
Sub filter_Test()
Sheet3.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Sheet2.Range("T1:T2"), _
      CopyToRange:=Sheet2.Range("H6")

End Sub
But when I try and Run it from Combobox1_Change I get the error
I also get the Same error if I try Debug.Print sheet3.Range("A1").CurrentRegion.Address

VBA Code:
Private Sub combobox1_Change()
Sheet3.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Sheet2.Range("T1:T2"), _
      CopyToRange:=Sheet2.Range("H6")
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Think it must be to do with Rowsource Somehow

Full user code is below. It populates ComboBox ok, but when a Selection in ComboBox is Selected that's when I get the error??

VBA Code:
Private Sub UserForm_Initialize()
Sheet2.Range("T2").ClearContents

Sheet3.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Sheet2.Range("T1:T2"), _
      CopyToRange:=Sheet2.Range("H6")

Me.ComboBox1.RowSource = "combo1Range"

End Sub

Private Sub combobox1_Change()
Sheet2.Range("T2").Value = Me.ComboBox1.Value

Sheet3.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
    CriteriaRange:=Sheet2.Range("T1:T2"), _
      CopyToRange:=Sheet2.Range("H6")

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,509
Members
449,089
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top