![]() |
Get The Length of data type of excel using visual basic
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 |
Get The Length of data type of excel using visual basic
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 |
Get The Length of data type of excel using visual basic
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 |
All times are GMT +1. The time now is 03:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com