Re-post: Using Combobox input in formula

Status
Not open for further replies.

alion

New Member
Joined
Aug 4, 2011
Messages
19
I am posting this thread again, guys please help me out.

--------------------
This is in continuation with my earlier question which was answered by John Davis (http://www.mrexcel.com/forum/showthr...77#post2840777). I am referring to the .Formula line in the code pasted below. In earlier version, we had B1>2,B1<=3 but now I am trying to link the values with combobox. I created two new variables (i dont know if they are called variables) low and high As Long and then I replaced 2 and 3 in with 'low' and 'high' so formula becomes B1>low,B1<=high. this change is giving type mismatch error in the second last line. Please help me out.


Sub Alion()
Sheets("Sheet1").Activate
Dim lr As Long
Dim lr2 As Long
Dim low As Long
Dim high As Long
low = ComboBox1
high = ComboBox2

lr = Cells(Rows.Count, 1).End(3).Row



With Range("C1:C" & lr)

.Formula = "=IF(AND(B1>2,B1<=3),A1,"""")"
.Value = .Value
.AutoFilter
.AutoFilter Field:=1, Criteria1:="<>"
.SpecialCells(xlCellTypeVisible).Copy Range("X1")
.AutoFilter

End With

lr2 = Cells(Rows.Count, 24).End(3).Row

MsgBox Join(WorksheetFunction.Transpose(Range("X1:X" & lr2)), vbLf)

End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Status
Not open for further replies.

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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