Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm working with importing text files into Excel that have account
names listed in one column and I'd like to repalce the account name with an account number. For Example, I would like to replace the name ADVERTISING with the number 63100 and I would like to replace the name PURCHASES with the number 51000. I would like to know if someone would be able to get me started with an Excel macro that I would just be able to continue the same formatting, adding records to achieve the same results but within a shorter period of time. Does anybody have an idea of how to help me get this one started? Thanks for helping, Josh |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Columns("A:A").Select
Selection.Replace What:="advertising", Replacement:="61300", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False Selection.Replace What:="Purchases", Replacement:="51000", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False or Sub MakeReplacements() dim varr as variant, varr1 as variant, i as long varr = Array("advertising", "purchases") varr1 = Array(63100, 51000) for i = lbound(varr) to ubound(varr) Columns(A:A).Replace What:=varr(i), Replacement:=varr1(i), _ LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False Next i End Sub -- Regards, Tom Ogilvy "Josh" wrote in message om... I'm working with importing text files into Excel that have account names listed in one column and I'd like to repalce the account name with an account number. For Example, I would like to replace the name ADVERTISING with the number 63100 and I would like to replace the name PURCHASES with the number 51000. I would like to know if someone would be able to get me started with an Excel macro that I would just be able to continue the same formatting, adding records to achieve the same results but within a shorter period of time. Does anybody have an idea of how to help me get this one started? Thanks for helping, Josh |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Take a look at the standard Excel vlookup function, in any event you'll need
a look up table to convert from the text data to a numerical value, perhaps on another sheet. Unless you wish to hard code these into a program (not usually recommended for dynamic data). How do you intend to establish the translation and maintain it? Cheers Nigel "Josh" wrote in message om... I'm working with importing text files into Excel that have account names listed in one column and I'd like to repalce the account name with an account number. For Example, I would like to replace the name ADVERTISING with the number 63100 and I would like to replace the name PURCHASES with the number 51000. I would like to know if someone would be able to get me started with an Excel macro that I would just be able to continue the same formatting, adding records to achieve the same results but within a shorter period of time. Does anybody have an idea of how to help me get this one started? Thanks for helping, Josh |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There appears to be syntax errors in the following assertions:
Columns(A:A).Replace What:=varr(i), Replacement:=varr1(i), _ LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False and Selection.Replace What:="advertising", Replacement:="61300", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False Selection.Replace What:="Purchases", Replacement:="51000", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False They all appear in red when I copy/paste it into VB editor. I have Excel 2000. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can ignore these since you have posted again with different
requirements. -- Regards, Tom Ogilvy "Josh Webskowski" wrote in message ... There appears to be syntax errors in the following assertions: Columns(A:A).Replace What:=varr(i), Replacement:=varr1(i), _ LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False and Selection.Replace What:="advertising", Replacement:="61300", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False Selection.Replace What:="Purchases", Replacement:="51000", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False They all appear in red when I copy/paste it into VB editor. I have Excel 2000. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find/Replace Numbers stored as Text drops zeros | Excel Discussion (Misc queries) | |||
Pivot Table - replace numbers with a text | Excel Discussion (Misc queries) | |||
Can I replace a ' at the beginning of a text cell using Replace | Excel Discussion (Misc queries) | |||
Replace numbers on x-axis of scatter chart with text eg 1 - one | Charts and Charting in Excel | |||
How to Replace numbers and text with numbers only? | Excel Worksheet Functions |