Concatenate Long Numbers - 26 Digits

Gos-C

Active Member
Joined
Apr 11, 2005
Messages
258
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,

I would like to concatenate a 10-digit number located in column A, a number located in column F and a number located in column G. The resulting string must be a 26-digit number. The number in column F must be 10 digits in length by adding leading zeroes (if required) and the number in G must be 6 digits by adding leading zeroes (if required). I am unable to figure it out.

I am getting scientific numbers with I used the following lines:

Code:
For i = 5 To lRow
ActiveSheet.Cells(i, 16).Value = CStr(ActiveSheet.Cells(i, 1).Value & ActiveSheet.Cells(i, 6).Value & ActiveSheet.Cells(i, 7).Value)
Next i

Any help?

Thanks,
Gos-C
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Code:
  Range(Cells(5, "P"), Cells(lRow, "P")).NumberFormat = "@"
  For i = 5 To lRow
    Cells(i, "P").Value = Format(Cells(i, "A").Value, "0000000000") & _
                          Format(Cells(i, "F").Value, "0000000000") & _
                          Format(Cells(i, "G").Value, "000000")
  Next i
 
Upvote 0
Thank you very much, Shg. I got it to work by modifying it as follows:

Code:
ActiveSheet.Range("P5:P" & lRow).NumberFormat = "@"
  For i = 5 To lRow
    ActiveSheet.Cells(i, 16).Value = Format(ActiveSheet.Cells(i, 1).Value, "0000000000") & _
                          Format(ActiveSheet.Cells(i, 6).Value, "0000000000") & _
                          Format(ActiveSheet.Cells(i, 7).Value, "000000")
  Next i

Cheers,
Gos-C
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,726
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top