Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem changing numbers in a string
I have a string that contains something like the following.
a=10%b=1%c=19%d=06%e=18%f=20% I need to change the numbers to new numbers contained on a Master sheet. For example: if the new number in Master(3, 1) = "1" and the new number in Master(3, 2) = "15". I want the string to now read a=1%b=15%, etc. This new string then will be changed again with yet new numbers over and over again as neded by the program I hope I have made it clear. Can someone please help me with this |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem changing numbers in a string
You need to remove the old data from the sring. You didn't provide enough
info to be able to remove the old string. Here is how to build the new string a = 1 b = 2 c = 3 d = 4 e = 5 MyStr = "a=" & a & "%b=" & b & "%c=" & c & "%d=" & d & "%e=" e & "%" "HarryGuy" wrote: I have a string that contains something like the following. a=10%b=1%c=19%d=06%e=18%f=20% I need to change the numbers to new numbers contained on a Master sheet. For example: if the new number in Master(3, 1) = "1" and the new number in Master(3, 2) = "15". I want the string to now read a=1%b=15%, etc. This new string then will be changed again with yet new numbers over and over again as neded by the program I hope I have made it clear. Can someone please help me with this |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem changing numbers in a string
You didn't give much detail but you should be able to use this idea.
Sub changenumbers() Application.ScreenUpdating = False For Each c In Selection v1 = "a=" & [h1] & "%" v2 = "b=" & [h2] & "%" v3 = "c=" & [h3] & "%" v4 = "d=" & [h4] & "%" v5 = "e=" & [h5] & "%" For i = 1 To 5 c.Value = v1 & v2 & v3 & v4 & v5 Next i Next c Application.ScreenUpdating = True End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "HarryGuy" wrote in message ... I have a string that contains something like the following. a=10%b=1%c=19%d=06%e=18%f=20% I need to change the numbers to new numbers contained on a Master sheet. For example: if the new number in Master(3, 1) = "1" and the new number in Master(3, 2) = "15". I want the string to now read a=1%b=15%, etc. This new string then will be changed again with yet new numbers over and over again as neded by the program I hope I have made it clear. Can someone please help me with this |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem changing numbers in a string
For what you have shown us, this will create the string you want to a
variable named OutString which you can then use in any way you need to... For X = 1 To UBound(Master, 2) OutString = OutString & Chr(96 + X) & "=" & Master(3, X) & "%" Next -- Rick (MVP - Excel) "HarryGuy" wrote in message ... I have a string that contains something like the following. a=10%b=1%c=19%d=06%e=18%f=20% I need to change the numbers to new numbers contained on a Master sheet. For example: if the new number in Master(3, 1) = "1" and the new number in Master(3, 2) = "15". I want the string to now read a=1%b=15%, etc. This new string then will be changed again with yet new numbers over and over again as neded by the program I hope I have made it clear. Can someone please help me with this |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem changing numbers in a string
Thanks very much to all who answered my call. I now have it working so on to
the next problem. Thanks again. "HarryGuy" wrote in message ... I have a string that contains something like the following. a=10%b=1%c=19%d=06%e=18%f=20% I need to change the numbers to new numbers contained on a Master sheet. For example: if the new number in Master(3, 1) = "1" and the new number in Master(3, 2) = "15". I want the string to now read a=1%b=15%, etc. This new string then will be changed again with yet new numbers over and over again as neded by the program I hope I have made it clear. Can someone please help me with this |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing A Column Of Text numbers To True Numbers: How ? | New Users to Excel | |||
changing numbers in a text string in a new cell | Excel Discussion (Misc queries) | |||
Changing column of numbers made of formulas to just numbers | Excel Discussion (Misc queries) | |||
Converting String numbers into real numbers | Excel Programming | |||
Converting String numbers into real numbers | Excel Programming |