+ Reply to Thread
Results 1 to 4 of 4

Macro to increase length of the cell.

  1. #1
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Macro to increase length of the cell.

    Hi Everyone,

    I am trying to connect database thru VB and it works. But, i am reading an input from other workbook. My required input should be 9 digits. While am reading the input there is a chance of input with less than 9 digits. So,i want to make sure that changing the input value into 9 digits and i tried with
    "ssn =FORMAT( x.Sheets("Sheet1").Range("B" & i).Value, "000000000")" but it showing an error called " '[IBM] [CLI Driver] [DB2/LINUXX8664] SQL0420N Invalid character found in a character string argument of the function "DECFLOAT".SQLSTATE =22018."

    Example :
    Input sheet : 123456
    Required data : 000123456

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Macro to increase length of the cell.

    What about:

    ssn = "'" & FORMAT( x.Sheets("Sheet1").Range("B" & I).Value, "000000000") & "'"

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Macro to increase length of the cell.

    If that does not work, then this should:

    ssn = x.Sheets("Sheet1").Range("B" & I).Value
    ssn = "'" & STRING(9-LEN(ssn),"0") & ssn & "'"
    Last edited by SlipEternal; 07-04-2017 at 04:41 PM.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to increase length of the cell.

    Maybe:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 04-23-2011, 10:28 AM
  2. Macro to increase cell value by 1
    By prontrad in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2009, 01:08 PM
  3. [SOLVED] Macro to increase String Length?
    By aronnov in forum Excel General
    Replies: 2
    Last Post: 05-15-2006, 02:35 PM
  4. [SOLVED] Validation drop-down lists:increase the default length
    By Lee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2006, 02:40 PM
  5. how to increase my column length to enter 600,000 entries
    By jeffrey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2005, 05:05 AM
  6. How do I increase the length of file names?
    By RJS in forum Excel General
    Replies: 1
    Last Post: 05-30-2005, 08:05 PM
  7. Using a macro to increase a value in a cell
    By powerman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-26-2005, 09:36 AM
  8. Increase Length of Name Box
    By Tim in forum Excel General
    Replies: 3
    Last Post: 01-26-2005, 03:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1