Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With a list of state/city in column A.
Wyoming - Greybull Indiana - South Bend Illinois - Itasca Texas - Mineral Wells Wyoming - Powell Wyoming - Cody Texas - Houston Illinois - Fox Valley Texas - Waco I want the city returned to column D, where aState is a selection in H1 DV drop down. The code errors on the word FIND in the MID function. The mid function works on the sheet as a formula. (with H1 cell ref, not rngC) Sub my_Instr_Copy() Dim LRow As Long Dim rngC As Range Dim aState As String, aCity As String With Sheets("Sheet1") LRow = .Cells(.Rows.Count, "A").End(xlUp).Row aCity = .Cells(1, 8) For Each rngC In .Range("A2:A" & LRow) Set aCity = Mid(rngC, Find("- ", rngC) + 2, 99) If InStr(rngC, aState) 0 Then Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp)(2) = aCity End If Next End With End Sub Thanks, Howard |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If find function to not find anything | Excel Programming | |||
Find function using chr | Excel Programming | |||
Need to find a function. | Excel Worksheet Functions | |||
Find Function | Excel Programming | |||
backwards find function to find character in a string of text | Excel Programming |