Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Formating a column in Excel programmatically

Formating a column in Excel programmatically

Scheduled Pinned Locked Moved Visual Basic
tutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Martin captivasystems
    wrote on last edited by
    #1

    I want to format a column so that all the cells in that column are percentage. Instead of doing this manually (highlight a column, right=click and select Format Cells..., and then change the Category to Percentage) I want to do it programmatically. Here is an example of how I did some formatting” 'WORD WRAP oWorkSheet.Cells.WrapText = True 'BOLD COLUMN HEADERS oWorkSheet.Range("A1", "CC1").Font.Bold() = True 'COLUMN WIDTH oWorkSheet.Columns(1).columnWidth() = 16.5 Thanks

    C 1 Reply Last reply
    0
    • M Martin captivasystems

      I want to format a column so that all the cells in that column are percentage. Instead of doing this manually (highlight a column, right=click and select Format Cells..., and then change the Category to Percentage) I want to do it programmatically. Here is an example of how I did some formatting” 'WORD WRAP oWorkSheet.Cells.WrapText = True 'BOLD COLUMN HEADERS oWorkSheet.Range("A1", "CC1").Font.Bold() = True 'COLUMN WIDTH oWorkSheet.Columns(1).columnWidth() = 16.5 Thanks

      C Offline
      C Offline
      Curtis Schlak
      wrote on last edited by
      #2

      How does this work for you? Columns("A").NumberFormat = "0.00%" I've always found that if I have to do some VBA, then I create and record a new macro, do what I want, then edit the macro to find out how Excel creates the code. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups