Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Reader,
I need length of the data type of excel and also want to know the technique to set the Excel column data type. These things I want with the help of Visual Basic Code. If it is possible to do so then please reply me as soon as possible. Regards, Sanjay Bol |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The length:
Function length(R As Range) As Integer Dim s As String s = R.Value length = Len(s) End Function To set format: Sub Macro1() Columns("F:F").Select Selection.NumberFormat = "@" End Sub Will, for example, set the format of the cells in column F to text. -- Gary''s Student " wrote: Dear Reader, I need length of the data type of excel and also want to know the technique to set the Excel column data type. These things I want with the help of Visual Basic Code. If it is possible to do so then please reply me as soon as possible. Regards, Sanjay Bol |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The Len function will return the number of bytes occupied by a
variable. E.g., Dim D As Double Debug.Print Len(D) With Strings, Len will return the number of characters stored in the string variable. E.g., Dim S As String S = "my string" Debug.Print Len(S) You can't set a column to a particular data type. All worksheet cells are Variants; that is, they can store any type of (non-object) values. You can use the NumberFormat property to change the way Excel *displays* the data, but this is an "output" function. It doesn't control what is actually stored in the cell, nor does it control what can be input into a cell. It controls only the displayed output. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message oups.com... Dear Reader, I need length of the data type of excel and also want to know the technique to set the Excel column data type. These things I want with the help of Visual Basic Code. If it is possible to do so then please reply me as soon as possible. Regards, Sanjay Bol |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Passing a range of data to a function - Excel - visual basic | Excel Programming | |||
Can I run Visual Basic procedure using Excel Visual Basic editor? | Excel Programming | |||
Visual Basic macro run time error(13) type mismatch | Excel Discussion (Misc queries) | |||
visual basic & chart data labels | Excel Programming |