登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

零售创新,创新那些事儿,SPSS,VBA

零售创新

 
 
 

日志

 
 
关于我

新浪微博,零售创新 研究经理,数据分析师 希望和市场研究和零售业的同事共同进步! 本博客发表的都是免费或试用的资料,如果有版权问题请发邮件wangli12a@163.com联系删除。 spss excel vba blog

单元格属性代码 (转)  

2012-03-31 16:56:18|  分类: VB和VBA知识 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

单元格属性代码 (转) 

 

          '单元格选择方法                             
                          
 
          Selection.NumberFormatLocal = "0.00_ "                  '分类(C)_数值
          Selection.NumberFormatLocal = "¥#,##0.00;¥-#,##0.00"  '分类(C)_货币
          Selection.NumberFormatLocal = "_ ¥* #,##0.00_ ;_ ¥* -#,##0.00_ ;_ ¥* ""-""??_ ;_ @_ "
          Selection.NumberFormatLocal = "yyyy-m-d"                '分类(C)_日期
          Selection.NumberFormatLocal = "[$-F400]h:mm:ss AM/PM"   '分类(C)_时间
          Selection.NumberFormatLocal = "0.00%"                   '分类(C)_百分比
          Selection.NumberFormatLocal = "# ?/?"                   '分类(C)_分数
          Selection.NumberFormatLocal = "0.00E+00"                '分类(C)_科学记数
          Selection.NumberFormatLocal = "@"                       '分类(C)_文本
          Selection.NumberFormatLocal = "000000"                  '分类(C)_特殊
          Selection.NumberFormatLocal = "G/通用格式"              '分类(C)_自定义
          注:以上红色00为小数位数。            
                 
          '单元格格式设置-对齐                           
          With Selection                
              .HorizontalAlignment = xlGeneral                    '水平对齐(H)_常规 
                                     xlLeft                       '水平对齐(H)_靠左(缩进) 
                                     xlCenter                     '水平对齐(H)_居中 
                                     xlRight                      '水平对齐(H)_靠右(缩进) 
                                     xlFill                       '水平对齐(H)_填充 
                                     xlJustify                    '水平对齐(H)_两端对齐(缩进) 
                                     xlCenterAcrossSelection      '水平对齐(H)_跨列居中 
                                     xlDistributed                '水平对齐(H)_分散对齐(缩进) 
              .VerticalAlignment = xlTop                          '垂直对齐(V)_靠上 
                                   xlCenter                       '垂直对齐(V)_居中 
                                   xlBottom                       '垂直对齐(V)_靠下 
                                   xlJustify                      '垂直对齐(V)_两端对齐 
                                   xlDistributed                  '垂直对齐(V)_分散对齐 
              .WrapText = False                                   '文本控制_自动换行(W) 
              .Orientation = 0                                    '方向_横向0度(D) 
                             xlVertical                           '方向_竖向 
              .AddIndent = False                  
              .IndentLevel = 0                                    '缩进_0(I) 
              .ShrinkToFit = False                                '文本控制_缩小字体填充(K) 
              .ReadingOrder = xlContext                           '文字方向(T)_根据内容 
                              xlLTR                               '文字方向(T)_总是从左到右 
                              xlRTL                               '文字方向(T)_总是从右到左 
              .MergeCells = False                                 '文本控制_合并单元格(M) 
          End With                 
                 
          '单元格格式设置-字体                           
          With Selection.Font              
 
 
              .Size = 12                                          '字号(S)_12 
              .Strikethrough = False                              '特殊效果_删除线 
              .Superscript = False                                '特殊效果_上标 
              .Subscript = False                                  '特殊效果_下标 
              .OutlineFont = False                  
              .Shadow = False                  
              .Underline = xlUnderlineStyleNone                   '下划线(U) 
                           xlUnderlineStyleSingle                 '单下划线  
                           xlUnderlineStyleDouble                 '双下划线  
                           xlUnderlineStyleSingleAccounting       '会计用单下划线 
                           xlUnderlineStyleDoubleAccounting       '会计用双下划线 
              .ColorIndex = xlAutomatic                           '颜色(C)_自动 
          End With                 
                 
          '单元格格式设置-边框                           
          Selection.Borders(xlDiagonalDown).LineStyle = xlNone    '右下斜线  
          Selection.Borders(xlDiagonalUp).LineStyle = xlNone      '左下斜线  
          Selection.Borders(xlEdgeLeft).LineStyle = xlNone        '左框线  
          Selection.Borders(xlEdgeTop).LineStyle = xlNone         '上框线  
          Selection.Borders(xlEdgeBottom).LineStyle = xlNone      '下框线  
          Selection.Borders(xlEdgeRight).LineStyle = xlNone       '右框线  
          Selection.Borders(xlInsideVertical).LineStyle = xlNone  '内竖线  
          Selection.Borders(xlInsideHorizontal).LineStyle = xlNone '内横线  
          Selection.Interior.ColorIndex = xlNone                  '线条颜色(C)_自动 
      '-----------------------------------------         
          With Selection.Borders(xlDiagonalDown)                  '右下斜线  
              .LineStyle = xlContinuous                           '线条样式_虚线线型___实线 
              .Weight = xlThin                                    '线条样式_线型(线宽)_细 
              .ColorIndex = xlAutomatic                           '线条颜色(C)_自动 
          End With                 
          With Selection.Borders(xlDiagonalUp)                    '左下斜线  
              .LineStyle = xlContinuous           
              .Weight = xlThin              
              .ColorIndex = xlAutomatic           
          End With                 
          With Selection.Borders(xlEdgeLeft)                      '左框线  
              .LineStyle = xlContinuous           
              .Weight = xlThin              
              .ColorIndex = xlAutomatic           
          End With                 
          With Selection.Borders(xlEdgeTop)                       '上框线  
              .LineStyle = xlContinuous           
              .Weight = xlThin              
              .ColorIndex = xlAutomatic           
          End With                 
          With Selection.Borders(xlEdgeBottom)                    '下框线  
              .LineStyle = xlContinuous           
              .Weight = xlThin              
              .ColorIndex = xlAutomatic           
          End With                 
          With Selection.Borders(xlEdgeRight)                     '右框线  
              .LineStyle = xlContinuous           
              .Weight = xlThin              
              .ColorIndex = xlAutomatic           
          End With                 
          With Selection.Borders(xlInsideVertical)                '内竖线  
               .LineStyle = xlContinuous           
               .Weight = xlThin              
               .ColorIndex = xlAutomatic           
          End With                 
          With  Selection.Borders(xlInsideHorizontal)             '内横线  
               .LineStyle = xlContinuous           
               .Weight = xlThin              
               .ColorIndex = xlAutomatic           
          End With                 
                 
          '单元格格式设置-图案                           
          Selection.Interior.ColorIndex = xlNone                  '单元格底纹  (无设置 ) 
          '-----------------------------------------        
          With  Selection.Interior             
               .ColorIndex = 0                                    '单元格底纹_颜色(C)_无颜色
               .Pattern = xlSolid                                 '单元格底纹_图案(P) 
               .PatternColorIndex = xlAutomatic                   '单元格底纹_图案(P)颜色 
          End With                 
                 
          '单元格格式设置-保护                           
          Selection.Locked = True                                 '锁定 (L)  
          

  评论这张
 
阅读(667)| 评论(0)

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018