Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have got a number that i need to split using code. Could somebody please help me out. it is always in this format 1234567-00 and i need to split it by the first 7 "1234567" in one column and then the last two "00" in another column. The minus "-" can be lost. Les Stout *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Les,
Try something like the following: Dim S As String Dim N1 As String Dim N2 As String S = "1234567-00" N1 = Left(S, 7) N2 = Right(S, 2) Range("A1").Value = "'" & N1 Range("B1").Value = "'" & N2 -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Les Stout" wrote in message ... Hello, I have got a number that i need to split using code. Could somebody please help me out. it is always in this format 1234567-00 and i need to split it by the first 7 "1234567" in one column and then the last two "00" in another column. The minus "-" can be lost. Les Stout *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks very much Chip, a further question to that.
The column has approx. 4000 parts in it would it be better to loop it down? or do you have a better suggestion. I am wanting to do it automated, running in the background. Your assistance is much appreciated. Les Stout *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can accomplish the same thing without VBA code, using two
formulas. =LEFT(A1,7) and =RIGHT(A1,2) Copy these formulas to cells B1 and C1, and then fill down as far as you need to go. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Les Stout" wrote in message ... Thanks very much Chip, a further question to that. The column has approx. 4000 parts in it would it be better to loop it down? or do you have a better suggestion. I am wanting to do it automated, running in the background. Your assistance is much appreciated. Les Stout *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something Like this:
Sub ParseString() Dim S As Variant Dim r As Range Dim c As Integer Dim N1 As String Dim N2 As String c = 1 For Each S In Range("A1:A4000") N1 = Left(S, 7) N2 = Right(S, 2) Cells(c, 2) = "'" & N1 Cells(c, 3) = "'" & N2 c = c + 1 Next S End Sub Derick Les Stout wrote in message ... Thanks very much Chip, a further question to that. The column has approx. 4000 parts in it would it be better to loop it down? or do you have a better suggestion. I am wanting to do it automated, running in the background. Your assistance is much appreciated. Les Stout *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to nest a left function within a sumif function? | Excel Worksheet Functions | |||
LEFT function-all to left of a comma? | Excel Worksheet Functions | |||
How can I get a leading zero (ZIP code) to show in a LEFT() calc? | Excel Worksheet Functions | |||
Left vs Left$ function | Excel Discussion (Misc queries) | |||
how to display zero at the left hand of a code in a cell say 045 | Excel Discussion (Misc queries) |