+ Reply to Thread
Results 1 to 4 of 4

Thread: Help To Edit VB

  1. #1
    Registered User
    Join Date
    09-11-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    11

    Help To Edit VB

    Hi,

    Anyone could help me in editing this VB's result in sheet 2 with out comma.This VB got it from the web,

    for example

    when i key in
    C=3
    1
    2
    3
    4

    i get result

    1, 2, 3
    1, 2, 4
    1, 3, 4
    2, 3, 4

    but i want result without comma

    123
    124
    134
    234

    Thank you
    Attached Files Attached Files
    Last edited by vanaj; 11-26-2011 at 11:22 PM.

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,151

    Re: Help To Edit VB

    Hi vanaj

    replace SavePermutation with

    Private Sub SavePermutation(ItemsChosen() As Integer, _
    Optional FlushBuffer As Boolean = False)
    
    Dim i As Integer, sValue As String
    Static RowNum As Long, ColNum As Long
    
    If RowNum = 0 Then RowNum = 1
    If ColNum = 0 Then ColNum = 1
    
    If FlushBuffer = True Or BufferPtr = UBound(Buffer()) Then
    If BufferPtr > 0 Then
    If (RowNum + BufferPtr - 1) > Rows.Count Then
    RowNum = 1
    ColNum = ColNum + 1
    If ColNum > 256 Then Exit Sub
    End If
    
    Results.Cells(RowNum, ColNum).Resize(BufferPtr, 1).Value _
    = Application.WorksheetFunction.Transpose(Buffer())
    RowNum = RowNum + BufferPtr
    End If
    
    BufferPtr = 0
    If FlushBuffer = True Then
    Erase Buffer
    RowNum = 0
    ColNum = 0
    Exit Sub
    Else
    ReDim Buffer(1 To UBound(Buffer))
    End If
    
    End If
    
    'construct the next set
    For i = 1 To UBound(ItemsChosen)
    sValue = sValue & vAllItems(ItemsChosen(i), 1)
    Next i
    
    'and save it in the buffer
    BufferPtr = BufferPtr + 1
    Buffer(BufferPtr) = sValue
    End Sub 'SavePermutation
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  3. #3
    Registered User
    Join Date
    09-11-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Help To Edit VB

    Thank you very much Pike.
    Last edited by shg; 11-27-2011 at 01:10 PM. Reason: deleted spurious quote

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Help To Edit VB

    vanaj, please take a few minutes to read the forum rules before posting again, and don't quote whole posts.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0