Consulting

Results 1 to 4 of 4

Thread: Values from 2 collumns into 1 column

  1. #1
    VBAX Regular
    Joined
    May 2011
    Posts
    46
    Location

    Values from 2 collumns into 1 column

    I am trying to get values from 2 columns into one, but can't get it done.
    This is what I tried

    Range("J12:J" & LRow + 1).Value = Range("P11:P" & LRow).Value & " | " & Range("Z11:Z" & LRow).Value
    all help welcome

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I'm using Rw instead of Lrow + 1.

    Dim Rw As String
    For Each Cel in Range("J12:J" & CStr(LRow + 1))
       Rw = CStr(Cel.Row - 1)
       Cel. = Range("P" & Rw) & " | " & Range("Z" & Rw)
    Next Cel
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    May 2011
    Posts
    46
    Location
    Thank you SamT

    It worked.
    Only had to change the following line a bit:

    Cel.value = Range("P" & Rw) & " | " & Range("Z" & Rw)

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I'm sorry about that. I am really embarrassed by my code today
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

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