Results 1 to 8 of 8

Thread: zero in excel

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908

    zero in excel

    How do i code in vb6 when i insert digit: 06 into one of the cells.Cos Currently it shows only 6 instead of 06. Thanks

    Regards
    Goh

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: zero in excel

    You could use the .NumberFormat="00" for the cell.

  3. #3
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: zero in excel

    Of use Text as its format...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908

    Re: zero in excel

    in excel itself how do i change that?

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: zero in excel

    Moved from Classic VB forum.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: zero in excel

    Quote Originally Posted by Goh
    in excel itself how do i change that?
    Select the Cell or Cells then go to Format Menu then select Cells then select Text...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2004
    Posts
    908

    Re: zero in excel

    hi sorry guys i think i have made a mistake here..I have a set of codes that actually open up a file which is saved as .csv and the input is per string basis through a loop.so there is no dim as excel.application so on and so forth...so how do i input with the numberformat ?

  8. #8
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: zero in excel

    this is the way to alter the numberformat in VBA of a cell
    Code:
    Cells(Row, Column).NumberFormat = "#.###.###.#00"
    this line wil alter it in the activesheet of the active workbook
    if you are using severalsheets or workbooks you need to specify them too, like this:
    Code:
    YourWorkbook.Sheets("YourSheet").Cells(Row, Column).NumberFormat = "#.###.###.#00"
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

Posting Permissions

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



Click Here to Expand Forum to Full Width