Solved

select specific numbers from a column of numbers in excel

Posted on 2012-03-26
10
223 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
  • 5
  • 5
10 Comments
 
LVL 45

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 45

Expert Comment

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

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 45

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

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

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 45

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
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 …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now