Solved

select specific numbers from a column of numbers in excel

Posted on 2012-03-26
10
260 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

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