Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
here's another way
Sub test2() Dim stra Dim i As Long For i = 1 To Application.CountA([a1:j1]) stra = stra & Cells(1, i).Value & "," Next stra = Left(stra, Len(stra) - 1) Debug.Print stra End Sub -- Gary "Maxi" wrote in message oups.com... I have the following numbers in range A1:J1 5 6 15 23 42 43 46 66 71 73 In my VBA code I have a sring variable strA which has a value "1, 2, 3, 4, 5" I want to replace the value of strA with numbers in range A1:J10. that means strA which was "1, 2, 3, 4, 5" earlier should become "5, 6, 15, 23, 42" that is cells(0,1).value, cells(0,2).value, cells(0,3).value, cells(0,4).value, cells(0,5).value similarly "3, 5, 6, 8, 10" should become "15, 42, 43, 66, 73" that is cells(0,3).value, cells(0,5).value, cells(0,6).value, cells(0,8).value, cells(0,10).value I want a shortest code available, preferably a one liner although I am not sure whether it is possible or not. Thanks Maxi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Replacing characters in cells string | Excel Programming | |||
Replacing a random string of 5 numbers | Excel Discussion (Misc queries) | |||
Replacing a string within a text file | Excel Programming | |||
Formula for Replacing Text in a String? | Excel Programming | |||
Replacing a value within a string using a formula | Excel Programming |