在Excel 2007 VBA中如何以编程方式冻结Excel工作表的顶行? [英] How can I programmatically freeze the top row of an Excel worksheet in Excel 2007 VBA?

查看:681
本文介绍了在Excel 2007 VBA中如何以编程方式冻结Excel工作表的顶行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以编程方式冻结VBA中Excel工作表的顶行。最终目标是产生与 View>相同的效果。冻结面板>在Excel 2007中冻结顶行命令,以便工作表的顶行被冻结,用户可以在浏览数据时查看工作表的顶行。

I am looking to programmatically freeze the top row of an Excel worksheet from VBA. The end goal is to produce the same effect as the View > Freeze Panes > Freeze Top Row command in Excel 2007 so that the top row of the worksheet is frozen and users can see the top row of the worksheet even as they scroll through the data.

推荐答案

Rows("2:2").Select
ActiveWindow.FreezePanes = True

为不同的效果选择不同的范围,与手动方式大致相同。 冻结顶行真的只是Excel 2007(及以上)中的一个快捷方式,与早期版本的Excel相比,它不包含添加的功能。

Select a different range for a different effect, much the same way you would do manually. The "Freeze Top Row" really just is a shortcut new in Excel 2007 (and up), it contains no added functionality compared to earlier versions of Excel.

这篇关于在Excel 2007 VBA中如何以编程方式冻结Excel工作表的顶行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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