Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sunday, October 25, 2015 at 7:32:49 PM UTC-5, Bruno Campanini wrote:
I have the numbers 1,2,3,4,5,6 in the source range("b4:g4") and would like to produce 1,2,3,4,5,6 2,3,4,5,6,1 3,4,5,6,1,2 4,5,6,1,2,3 5,6,1,2,3,4 6,1,2,3,4,5 Basically the code would take each number in the source range and place it in the 6th column if it is between 1 and 10 inclusive. First it would have to the count how many numbers in the source range "b4:g4" are equal to and less than 10. In this case the 6 numbers are less than 10 so it would produce 6 results. if it was 5 numbers that are less than 10 then it would produce 5 results. If all the numbers are more than 10 then no action is required. The numbers in the source range can be in any order not necessarily in sequence. Any help would be greatly appreciated. Thank you Try this: ================================ Public Sub ShiftLeft() Dim A, B, C, R, i, j Dim Separator As String R = [F2!B4:G4] Separator = "," For Each i In R A = A & i & Separator Next A = Left(A, Len(A) - 1) MsgBox A For j = 1 To 5 B = Split(A, Separator, -1, 1) For i = 1 To 5 C = C & B(i) & Separator Next C = C & B(0) MsgBox C A = C C = NullString Next End Sub ============================== Bruno Very close. No result should have a value of more than 10 1n the rightmost column. Thank you |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to select top six numbers from a of range of random numbers | Excel Worksheet Functions | |||
Rearrange numbers from a column in a different order in a second c | Excel Discussion (Misc queries) | |||
two columns range of numbers need to list all numbers in the range | New Users to Excel | |||
macro to rearrange numbers in cell? | Excel Programming | |||
Count comma separated numbers, numbers in a range with dash, not t | Excel Discussion (Misc queries) |