473,378 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

format an excel cell

juve11
20
hello,
i made alot of changes to an excel sheet from visual basic like bordering,setting landscape,margins... but there is a thing a didnt managed to change : the cell format.

i have two columns and i need that all the cells from those columns to be type "text"

do you have any ideas?

thank you
Nov 6 '07 #1
4 1400
QVeen72
1,445 Expert 1GB
Hi,

This makes Column B and Column C as Text Columns..

Expand|Select|Wrap|Line Numbers
  1. Range("B:B").NumberFormat = "@"
  2. Range("C:C").NumberFormat = "@"
  3.  
Say you want only first 20 Cells of Columnd as Text, then:

Expand|Select|Wrap|Line Numbers
  1. Range("D1:D20").NumberFormat = "@"
  2.  
Regards
Veena
Nov 6 '07 #2
juve11
20
hi,thank you for posting!
i try in my project you're idea but doesnt works like i need : i have a database in access wich i am taking to excel via visual basic. the database contains two columns with telephone numbers : standalone and mobile. both start with "0".so, when i put the database in excel it does not trasfer the leading "0" , just the rest of the number.

i sauth that if i format the cell to "text" everything is ok,that's why i asked how do you change the type of a cell in excel from visual basic.

thank you.
Nov 6 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

Pass the above Code (My Previous Post), before populating the data to Excel, or PreFix the database Text Value with Single Quote say:

Expand|Select|Wrap|Line Numbers
  1. Cells(10, 2 ) = "'" & RST("MyFieldName")
  2.  
Preceeding Quote ensures, it as a Text Field..

Regards
Veena
Nov 6 '07 #4
juve11
20
indeed, you are right, thank you very much for youre time.

my best regards.
Nov 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Heinz Müller | last post by:
Hi! I know how to create a new Excel Document in C# and how to fill the WorkSheet with data. But i didn't found any informations how i can insert a hyperlink (for example to...
8
by: John Brock | last post by:
I am creating an Excel workbook using VB.NET, and have run into a problem. Excel at times insists on reformatting data that I enter into cells, e.g., converting "01234" to "1234", and this screws...
6
by: Piotr | last post by:
Hi, I have following problem: I use a form in excel to send data into mysql server, everything is ok unless I have to deal with decimals or data fields, this simple are not recognized. For...
1
by: desi.american | last post by:
I have a dynamically generates ASPX page with tables and data. Depending on user selection, the same page can be viewed as a simple web page (rendered in HTML) or as an excel spreadsheet. If the...
2
by: Brian Parker | last post by:
I need to format text in cell in an Excel worksheet and I need to do this using C#. I've seen code that will set the format for the whole cell, but I just need to format one character in that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.