LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default MID and FIND function in vba

Hi Howard,

Am Sat, 4 Jun 2016 02:57:39 -0700 (PDT) schrieb L. Howard:

With my_Instr_Copy() code it errors wanting an Object or Variable set, tried many different sets, but don't see it.


Set aCity = Mid(aState, InStr(aState, " - ") + 3, 99)


aCity is a string and not an object.
try:
aCity = Mid(aState, InStr(aState, " - ") + 3, 99)

Sub Test()
Dim LRow As Long, i As Long
Dim varCity() As Variant, varTmp As Variant

With Sheets("Sheet1")
LRow = .Cells(.Rows.Count, 1).End(xlUp).Row
varTmp = .Range("A2:A" & LRow)

ReDim Preserve varCity(UBound(varTmp))
For i = LBound(varTmp) To UBound(varTmp)
varCity(i) = Split(varTmp(i, 1), " - ")(1)
Next
.Cells(.Rows.Count, 4).End(xlUp)(2).Resize(UBound(varCity) + 1) _
= Application.Transpose(varCity)
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If find function to not find anything Carlos Excel Programming 4 February 14th 08 09:25 AM
Find function using chr gazza67[_2_] Excel Programming 1 September 13th 07 08:42 AM
Need to find a function. MikeCampbell Excel Worksheet Functions 2 January 29th 07 01:40 AM
Find Function kiza[_4_] Excel Programming 2 June 11th 04 02:49 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"