Solved

select specific numbers from a column of numbers in excel

Posted on 2012-03-26
10
257 Views
Last Modified: 2012-03-27
There is a column of numbers like this "19840: [6396".  I am seeking a script that will copy the last four numbers into a separate column.
0
Comment
Question by:gregfthompson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 47

Expert Comment

by:Martin Liss
ID: 37769343
Assuming the data is in col A and you want the new data in B then…


Private Sub CommandButton1_Click()
Dim r As Range
Dim i As Long

Set r = Range("A1").End(xlDown).Offset(0, 0)
For i = 1 To r.Row

    Range("B" & i).Value = Right(Range("A" & i).Value, 4)

Next

End Sub
0
 

Author Comment

by:gregfthompson
ID: 37769418
Thanks MartinLiss.

Can you amend the file and attach?

Greg
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 37769426
I'm sorry but what file? Did you mean to attach one?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:gregfthompson
ID: 37769446
I've amended the file to have the original column is now A.

Can you include the macro? File is attached.

Thanks,

Greg
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 37769451
Sorry but there's still no file attached. And I'm on my way out the door for the night… sorry.
0
 

Author Comment

by:gregfthompson
ID: 37769480
Sorry. Here it is.  I am unable to make it work.
Number-split.xlsm
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 37769497
I put data in col A and it worked just fine. Did you notice that it is code for a command button?
0
 

Author Comment

by:gregfthompson
ID: 37770623
Can you upload the file?
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 37771596
Okay here it is.Number-split.xlsm
0
 

Author Closing Comment

by:gregfthompson
ID: 37773556
Thank you!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question