VBA search column for matching string
Solved/Closed
pidge
Posts
3
Registration date
Sunday 13 June 2010
Status
Member
Last seen
13 June 2010
-
13 Jun 2010 à 20:30
Juzer - 25 Aug 2016 à 02:44
Juzer - 25 Aug 2016 à 02:44
Related:
- Excel vba find string in column
- Excel vba find - Guide
- Excel column number - Guide
- Vba select case string - Guide
- Vba excel mac - Guide
- Excel count occurrences of string in column - Guide
3 responses
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
13 Jun 2010 à 21:21
13 Jun 2010 à 21:21
Sub SeekFishInfo()
Dim lMaxRows As Long
Sheets("Colour Spots").Select
lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row
If lMaxRows < 2 Then Exit Sub
'=VLOOKUP(B2,'Fish List'!A:E,2,0)
With Range(Cells(2, 5), Cells(lMaxRows, 5))
.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC2, 'Fish List'!C1:C5,2,0)),"""",VLOOKUP(RC2, 'Fish List'!C1:C5,2,0))"
.Copy
.PasteSpecial xlPasteValues
End With
With Range(Cells(2, 6), Cells(lMaxRows, 6))
.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC2, 'Fish List'!C1:C5,3,0)),"""",VLOOKUP(RC2, 'Fish List'!C1:C5,3,0))"
.Copy
.PasteSpecial xlPasteValues
End With
With Range(Cells(2, 7), Cells(lMaxRows, 7))
.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC2, 'Fish List'!C1:C5,4,0)),"""",VLOOKUP(RC2, 'Fish List'!C1:C5,4,0))"
.Copy
.PasteSpecial xlPasteValues
End With
End Sub
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
13 Jun 2010 à 20:47
13 Jun 2010 à 20:47
Could you please upload a sample file with sample data etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc and post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too
pidge
Posts
3
Registration date
Sunday 13 June 2010
Status
Member
Last seen
13 June 2010
13 Jun 2010 à 20:57
13 Jun 2010 à 20:57
Here is a sample data file
https://authentification.site/files/22947760/PidgeDataSample.xls
What I want is in the sheet 'Colour Spots' for each row, I want to find the same fishID the Fish List sheet and then copy paste the river, site and predation for that fishID from Fish List (Sheet) to Colour Spots (sheet).
In other words, I need to fill in site predation and year on the colour spots sheet by finding the proper information on the Fish List sheet.
Does this make more sense?
https://authentification.site/files/22947760/PidgeDataSample.xls
What I want is in the sheet 'Colour Spots' for each row, I want to find the same fishID the Fish List sheet and then copy paste the river, site and predation for that fishID from Fish List (Sheet) to Colour Spots (sheet).
In other words, I need to fill in site predation and year on the colour spots sheet by finding the proper information on the Fish List sheet.
Does this make more sense?
13 Jun 2010 à 23:05