Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default help with part of my macro

I have a data table that is sent to me from a 3rd party vendor and in the
cell the vendor uses letters to refer to what they mean for example:

c = Rock-Eval analysis checked and confirmed
lc = Leco TOC analysis checked and confirmed

I need to create a macro that will look at this letter and put in what it
correlates to. To make it even harder, sometimes there are multiple letters
that refer to a sentence. Such as "c,lc". The combinations in letters vary
from the data I recieve. If both letters appears I would like to see
"Rock-Eval and Leco TOC analysis checked and confirmed"

Thanks for any help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default help with part of my macro

range name a table where the first column is the letters and the second
column the description...
so row 1 column 1 is LC
and row 1 column 2 is Leco Toc
i my code, i used TASKLIST as teh range name.
I create a user defined function (UDF) that tales the cell vale, eg C or
C,LS and returns the concatenated list

Option Explicit
' NOTE datatabel is ranged named TASKLIST
Public Function decode(text As String) As String
Dim item As Variant
For Each item In Split(text, ",")
decode = decode & ", " & safelookup(item)
Next
decode = Mid(decode, 3)
End Function
Function safelookup(item)
On Error Resume Next
safelookup = Application.WorksheetFunction.VLookup(CStr(item), _
Range("TASKLIST"), 2, False)
On Error GoTo 0
End Function


"James" wrote:

I have a data table that is sent to me from a 3rd party vendor and in the
cell the vendor uses letters to refer to what they mean for example:

c = Rock-Eval analysis checked and confirmed
lc = Leco TOC analysis checked and confirmed

I need to create a macro that will look at this letter and put in what it
correlates to. To make it even harder, sometimes there are multiple letters
that refer to a sentence. Such as "c,lc". The combinations in letters vary
from the data I recieve. If both letters appears I would like to see
"Rock-Eval and Leco TOC analysis checked and confirmed"

Thanks for any help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default help with part of my macro

i would say, first insert a couple of columns & break out that column,
using a comma as a delimiter, using Text To Columns.
then it's a simply search-&-replace operation from there (you could
record it all with the macro recorder & see what you come up with -
not the most efficient coding, but a place to start).
hope this helps
susan


On Mar 12, 9:50*am, James wrote:
I have a data table that is sent to me from a 3rd party vendor and in the
cell the vendor uses letters to refer to what they mean for example:

c = Rock-Eval *analysis checked and confirmed
lc = Leco TOC analysis checked and confirmed

I need to create a macro that will look at this letter and put in what it
correlates to. *To make it even harder, sometimes there are multiple letters
that refer to a sentence. Such as "c,lc". *The combinations in letters vary
from the data I recieve. If both letters appears I would like to see
"Rock-Eval and Leco TOC analysis checked and confirmed"

Thanks for any help


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default help with part of my macro

Took me a bit to get it to work but it is going now, thanks again.

"Patrick Molloy" wrote:

range name a table where the first column is the letters and the second
column the description...
so row 1 column 1 is LC
and row 1 column 2 is Leco Toc
i my code, i used TASKLIST as teh range name.
I create a user defined function (UDF) that tales the cell vale, eg C or
C,LS and returns the concatenated list

Option Explicit
' NOTE datatabel is ranged named TASKLIST
Public Function decode(text As String) As String
Dim item As Variant
For Each item In Split(text, ",")
decode = decode & ", " & safelookup(item)
Next
decode = Mid(decode, 3)
End Function
Function safelookup(item)
On Error Resume Next
safelookup = Application.WorksheetFunction.VLookup(CStr(item), _
Range("TASKLIST"), 2, False)
On Error GoTo 0
End Function


"James" wrote:

I have a data table that is sent to me from a 3rd party vendor and in the
cell the vendor uses letters to refer to what they mean for example:

c = Rock-Eval analysis checked and confirmed
lc = Leco TOC analysis checked and confirmed

I need to create a macro that will look at this letter and put in what it
correlates to. To make it even harder, sometimes there are multiple letters
that refer to a sentence. Such as "c,lc". The combinations in letters vary
from the data I recieve. If both letters appears I would like to see
"Rock-Eval and Leco TOC analysis checked and confirmed"

Thanks for any help

Reply
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
Replace Old Part Numbers with New Part Numbers in a Macro. Jeffery Keown Excel Discussion (Misc queries) 5 October 17th 06 03:45 PM
Pain in the ass macro Part 2 JesseK[_3_] Excel Programming 2 July 7th 05 05:59 PM
Run only part of a macro for testing Josh O. Excel Programming 4 May 19th 05 04:49 PM
Macro Question Part II Me Excel Programming 2 March 4th 05 08:55 PM
ruuning part of a macro from another macro pauluk[_69_] Excel Programming 2 July 26th 04 01:40 PM


All times are GMT +1. The time now is 07:15 PM.

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

About Us

"It's about Microsoft Excel"