Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Option Explicit
  2.  
  3. Sub concatena_colunas()
  4. Dim coluna_01 As Long
  5. Dim coluna_02 As Long
  6. Dim linha As Long
  7.  
  8. On Error GoTo sair:
  9. 'Armazena e coloca em ordem crescente
  10. coluna_01 = Selection.Areas(1).Column
  11. If Selection.Areas(2).Column < coluna_01 Then
  12. coluna_02 = Selection.Areas(1).Column
  13. coluna_01 = Selection.Areas(2).Column
  14. Else
  15. coluna_02 = Selection.Areas(2).Column
  16. End If
  17.  
  18. linha = ActiveCell.Row
  19.  
  20. Do
  21. Cells(linha, coluna_01).Value = Cells(linha, coluna_01).Value & " " & Cells(linha, coluna_02).Value
  22. linha = linha + 1
  23. Loop While Cells(linha, coluna_01).Value <> Empty
  24.  
  25. coluna_01 = 0
  26. coluna_02 = 0
  27. linha = 0
  28. sair:
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement