Solved

excel 201 change format from text no number

Posted on 2013-06-14
11
462 Views
Last Modified: 2013-06-18
I'm using 201 and when I insert a row of numbers some of them change to text. there are over 2000 items in the column. I need some vba code [as this is part of a macro] to change the entire column to number format.

thanks
0
Comment
Question by:Jagwarman
[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
  • 6
  • 5
11 Comments
 

Author Comment

by:Jagwarman
ID: 39247844
that should be 2010 not 201

thanks
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 39247874
Columns("A:A").Select
    Selection.NumberFormat = "0.00"
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 39247877
Or better

Columns("A:A").NumberFormat = "0.00"
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:Jagwarman
ID: 39253493
MartinLiss I tried this but it does not work.

What I am doing is copying from another file then stripping out 7 characters from the cell. In so doing the cell becomes text. I get that little green triangle top left that when you click on it, it says "the number in this cell is formatted as text or preceded by an apostrophy. The when I open that I can convert it to a number. When I do it manually that way it works.

So, is there a way to convert it to a number using VBA. As I said your solution [unfortunately] did not work.

thanks
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 39253528
Here's an article that should help.
0
 

Author Comment

by:Jagwarman
ID: 39253567
Hi MartinLiss.

I found this code but I have to 'manually' highlight the column. Would you be able to make a change to the code so that it works by selecting Column B

Sub ConvertTextNumbers()
 
Dim rUsedRange As Range
 
' Convert all cells with numbers from text to numbers

For Each rUsedRange In Intersect(ActiveSheet.UsedRange, Selection).Areas
rUsedRange.Value = rUsedRange.Value
Next rUsedRange
 
End Sub


Thanks
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 39253570
Did you look at the article I posted?
0
 

Author Comment

by:Jagwarman
ID: 39254087
I did but unfortunately it didn't help me

Regards
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39254311
Try this


Sub ConvertTextNumbers()
Dim c As Range

Columns("B:B").Select
For Each c In Selection
    c.Value = c.Value
Next

End Sub

Open in new window

0
 

Author Closing Comment

by:Jagwarman
ID: 39255354
Thanks Martin brilliant just what I needed.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 39256367
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Way to transfer 29 62
Removing bloatware from the new computer after Windows Pro is installed 17 86
Office 365 Spam 3 33
Output Different in Excel Compared In SSMS 8 14
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

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