---
title: "vb 实现打开excel 单元格自适应高度"
author: "onlyor"
date: "2014-12-03T14:05:55Z"
tags: []
categories: ["编程语言"]
slug: "vb-excel"
draft: false
lastmod: "2014-12-03T14:05:55Z"
id: 2162880
url: "https://onlyor.iteye.com/blog/2162880"
---

```
Sub auto_open()
'
' 宏2 宏
'
Dim g As Integer
g = 3


For i = 1 To 2

    Range("a" + CStr(i + (i - 1) * 3) + ":c" + CStr(i * 3)).Select
    Selection.UnMerge
    Selection.Rows.AutoFit
    Selection.Merge
    
Next i

    
End Sub
```