Results 1 to 6 of 6

Thread: Add to Make a String

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Expert brettdj's Avatar
    Joined
    May 2004
    Location
    Melbourne
    Posts
    649
    Location
    You dont want to be looping

    This code doesn't check for input or source length & type. Do you want that?


    Sub ConA()
        Dim Myrange As Range, Mystr As String
        Application.ScreenUpdating = False
    Mystr = InputBox("Enter the 6 number string to be appended to Column A")
    Set Myrange = ActiveSheet.Range(ActiveSheet.Range("A2"), ActiveSheet.Range("A65536").End(xlUp))
        Set Myrange = Intersect(Myrange, ActiveSheet.Cells.SpecialCells(xlConstants))
    With Myrange
        .Offset(0, 1).Columns.Insert
        .Offset(0, 1).FormulaR1C1 = "=Concatenate(RC[-1], """ & Mystr & """)"
        .Offset(0, 1).FormulaR1C1Local = .Offset(0, 1).Value
        .Columns.Delete
        End With
    Application.ScreenUpdating = True
    End Sub
    Last edited by brettdj; 06-16-2004 at 11:10 PM.

Posting Permissions

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