Hi,
I am working with 2 worksheet in the same workbook. Sheet1 has the values. Sheet 2 has the table of data with header.
My goal is to read the values from sheet1 and then filter a specific column with that said value. I can get that far. The issue is my value in sheet1 is not an exact value of what would be in sheet2.
for example. In sheet1 I have values of a = 5.68. Now when I go in sheet2 it does not have 5.68 in the "a" column but I want to select and filter the values that a =5.68 falls into. for example sheet2 may have 4.5 and 7.5. if those are the values closest/nearest to the a values then I want to filter them. In summary if a = 5.68 in sheet 2, then I go in sheet2 and filter the range that 5.68 falls into and those values would be 4.5 and 7.5 and take the resulting value in the next column and paste it in a new sheet.
Here's what I started with:
Sub Filter_criteria()
Dim A As String
With Worksheets("Sheet1")
Set Al = .Range("A11")
End With
With Worksheets("Sheet2")
With .Range("A1:N" & Cells(.Rows.Count, "N").End(xlUp).Row)
.AutoFilter
Range("K1").AutoFilter Field:=11, Criteria1:=lat, Operator:=xlFilterValues
End With
.AutoFilterMode = False
End With
End Sub
I am working with 2 worksheet in the same workbook. Sheet1 has the values. Sheet 2 has the table of data with header.
My goal is to read the values from sheet1 and then filter a specific column with that said value. I can get that far. The issue is my value in sheet1 is not an exact value of what would be in sheet2.
for example. In sheet1 I have values of a = 5.68. Now when I go in sheet2 it does not have 5.68 in the "a" column but I want to select and filter the values that a =5.68 falls into. for example sheet2 may have 4.5 and 7.5. if those are the values closest/nearest to the a values then I want to filter them. In summary if a = 5.68 in sheet 2, then I go in sheet2 and filter the range that 5.68 falls into and those values would be 4.5 and 7.5 and take the resulting value in the next column and paste it in a new sheet.
Here's what I started with:
Sub Filter_criteria()
Dim A As String
With Worksheets("Sheet1")
Set Al = .Range("A11")
End With
With Worksheets("Sheet2")
With .Range("A1:N" & Cells(.Rows.Count, "N").End(xlUp).Row)
.AutoFilter
Range("K1").AutoFilter Field:=11, Criteria1:=lat, Operator:=xlFilterValues
End With
.AutoFilterMode = False
End With
End Sub