Thread: 2 issues really
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default 2 issues really

Give this code a try..

Sub ConcatBandC()
Dim X As Long, LastRow As Long
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
For X = 2 To LastRow
Cells(X, "B").Value = Cells(X, "B").Value & Format( _
Cells(X, "C").Value, " 00000")
Next
End Sub

--
Rick (MVP - Excel)


"broro183" wrote in message
...

hi,

This is posted in the Programming forum but here are a couple of
non-vba solutions...

1)
- select the cells, press [ctrl + 1], Number - Custom, & type 00000
into the Type field.
- Or, using a helper column eg column D, type
Code:
--------------------
=TEXT(C1,"00000")
--------------------
& copy down as needed.

2)
- In a helper column, eg column D, type
Code:
--------------------
=B2 & " " & C2
--------------------
, copy down as needed, select all the cells, press [ctrl + c], select
cell B2 & press [alt + E + S + V] to paste special as values over the
top of the original data.

If you do still want a macro solution, record a macro as you complete
the actions manually & then post the recorded code if you need help
making it flexible.

hth
Rob


--
broro183

Rob Brockett. Always learning & the best way to learn is to
experience...
------------------------------------------------------------------------
broro183's Profile:
http://www.thecodecage.com/forumz/member.php?userid=333
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=144631