Thread
:
Select specific Data from a cell
View Single Post
#
8
Posted to microsoft.public.excel.programming
Gord Dibben
external usenet poster
Posts: 22,906
Select specific Data from a cell
Bob
I think Chip meant InStr and not "Inkster"
Make the change and try again. Works for me.
Gord Dibben Excel MVP
On Thu, 24 Mar 2005 21:47:00 GMT,
wrote:
I tried it.
This is what I did:
Highlighted the column that contains the data
pasted the code in as directed
got an error message Compile error sub or function not defined.
The word "Inkster" in the
VB
code was highlighted
Did I do something wrong?
TIA
Bob
On Thu, 24 Mar 2005 15:24:35 -0600, "Chip Pearson"
wrote:
Bob,
Yes, it is VBA code. Press ALT+F11 to open the VBA editor. Go to
the Insert menu and choose Module. In that module, paste the
following code:
Sub AAA()
Dim S As String
Dim F As String
Dim Pos As Integer
S = Range("A1").Text
Pos = Inkster(1, S, "|")
F = Left(S, Pos - 1)
MsgBox F
End Sub
To run the macro, switch back to Excel, press ALT+F8 and select
the macro from the list.
Reply With Quote
Gord Dibben
View Public Profile
Find all posts by Gord Dibben