Excel VBA - 格式化不包括标题行的整列 [英] Excel VBA - format a whole column excluding the heading line

查看:126
本文介绍了Excel VBA - 格式化不包括标题行的整列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想格式化列,但排除第一行,因为这是标题:

I want to format a column but to exclude the first row as this is the header:

我目前的代码是:

Sheets("Sheet1").Columns(3).NumberFormat = "#,##0"

谢谢。

推荐答案

除非标题是一个数字不应该这样做,我不认为。数字格式不会影响文本(至少不会太多)。但是这是一种方式:

Unless the header is a number you shouldn't need to do this, I don't think. The number format won't affect text (at least not much). But here's a way:

With ThisWorkbook.Sheets("Sheet1")
   .Columns(3).Resize(.Rows.Count - 1, 1).Offset(1, 0).NumberFormat = "#,##0"
End With

这篇关于Excel VBA - 格式化不包括标题行的整列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆