ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a value in the collumn and then in that row (https://www.excelbanter.com/excel-programming/318189-find-value-collumn-then-row.html)

OxanaB

Find a value in the collumn and then in that row
 
I need to find a cell value in the column in the sheet "FEDEX" that maches
entered value on the sheet "Calculate" and then I need to find a cell value
in that row in the column number that entered on sheet "Calculate". I need to
get last value in the sheet "Calculate".

Thank you for any hint!

Sheets("FEDEX").Range("A1:A975").Select
For Each Cell In Selection
x = Cells(Rows.Count, "a").End(xlUp).Row + 1
If Cell.Value = Sheets("Calculate").Range("F6").Value Then
ell.EntireRow.Select
For Each Cell1 In Selection
x = Cells(Column.Count, "a").End(xlLeft).Column + 1
If Cell1.Value = Sheets("Calculate").Range("E8").Value Then
Cell1.Value.Select
Next Cell1
Next Cell
End Sub

JE McGimpsey

Find a value in the collumn and then in that row
 
Does it have to be a programming solution?

Try:

=VLOOKUP(F6,FEDEX!A:Z,E8,FALSE)

You can use that in programming, too:

Dim vResult As Variant
Dim vWhat As Variant
Dim rRange As Range
Dim nCol As Long
With Sheets("Calculate")
vWhat = .Range("F6").Value
nCol = .Range("E8").Value
End With
Set rRange = Sheets("FEDEX").Range("A:Z")
vResult = Application.VLookup(vWhat, rRange, nCol, False)
Sheets("Calculate").Range("A1").Value = vResult



In article ,
OxanaB wrote:

I need to find a cell value in the column in the sheet "FEDEX" that maches
entered value on the sheet "Calculate" and then I need to find a cell value
in that row in the column number that entered on sheet "Calculate". I need to
get last value in the sheet "Calculate".

Thank you for any hint!

Sheets("FEDEX").Range("A1:A975").Select
For Each Cell In Selection
x = Cells(Rows.Count, "a").End(xlUp).Row + 1
If Cell.Value = Sheets("Calculate").Range("F6").Value Then
ell.EntireRow.Select
For Each Cell1 In Selection
x = Cells(Column.Count, "a").End(xlLeft).Column + 1
If Cell1.Value = Sheets("Calculate").Range("E8").Value Then
Cell1.Value.Select
Next Cell1
Next Cell
End Sub


OxanaB

Find a value in the collumn and then in that row
 
Thank you very much.
It worked and I used VLOOKUP.

"JE McGimpsey" wrote:

Does it have to be a programming solution?

Try:

=VLOOKUP(F6,FEDEX!A:Z,E8,FALSE)

You can use that in programming, too:

Dim vResult As Variant
Dim vWhat As Variant
Dim rRange As Range
Dim nCol As Long
With Sheets("Calculate")
vWhat = .Range("F6").Value
nCol = .Range("E8").Value
End With
Set rRange = Sheets("FEDEX").Range("A:Z")
vResult = Application.VLookup(vWhat, rRange, nCol, False)
Sheets("Calculate").Range("A1").Value = vResult



In article ,
OxanaB wrote:

I need to find a cell value in the column in the sheet "FEDEX" that maches
entered value on the sheet "Calculate" and then I need to find a cell value
in that row in the column number that entered on sheet "Calculate". I need to
get last value in the sheet "Calculate".

Thank you for any hint!

Sheets("FEDEX").Range("A1:A975").Select
For Each Cell In Selection
x = Cells(Rows.Count, "a").End(xlUp).Row + 1
If Cell.Value = Sheets("Calculate").Range("F6").Value Then
ell.EntireRow.Select
For Each Cell1 In Selection
x = Cells(Column.Count, "a").End(xlLeft).Column + 1
If Cell1.Value = Sheets("Calculate").Range("E8").Value Then
Cell1.Value.Select
Next Cell1
Next Cell
End Sub




All times are GMT +1. The time now is 11:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com