Solved

How to set number/text format in Excel or PPT datasheet cells?

Posted on 2006-06-22
2
816 Views
Last Modified: 2008-01-09
Hello all,

I have a chart in MS PowerPoint.  The chart is an actual chart with a datasheet, not just a pasted in image.  A VBA macro updates the datasheet with data for the chart.  But when it inputs a number range like "3 - 10" in the column header row of the datasheet - the row that holds the titles of the columns - PPT is then applying a data ormat to them and on my chart "3-10" becomes "10-March".

So I want to explicitly set the format of the datasheet cell to "text".  But I can't find the right code.  I assume t's the samew as for Excel, as I 've found that it usually is.

Anyone kow?

Thanks.
0
Comment
Question by:xfvgdrthbdtyvhgscv
2 Comments
 
LVL 17

Accepted Solution

by:
inthedark earned 500 total points
ID: 16959414


Range("C5").Select ' the cell you want to change

Selection.NumberFormat = "@" ' format as text (do this first)

ActiveCell.FormulaR1C1 = "10-3" ' place in the data
0
 
LVL 1

Author Comment

by:xfvgdrthbdtyvhgscv
ID: 16964968
Yes! We have a winner.  Worked perfectly.  Thanks a bunch.
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

789 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