如何設定複製迴圈sheet1複製儲存格至sheet2固定位置????
- 帖子
- 552
- 主題
- 6
- 精華
- 0
- 積分
- 576
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- office 2010
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2015-2-8
- 最後登錄
- 2026-9-10
  
|
回復 1# poke0817
是這樣嗎?
我把標籤樣式改到Sheet3以應第2個問題- Public Sub ex()
- Dim rng As Range, r%, c%
- Sheet3.Range("a1:h" & Sheet3.Cells(Rows.Count, 1).End(xlUp).Row).Delete
- r = 1
- c = 1
- For i = 1 To 8 Step 2
- Sheet3.Columns(i).ColumnWidth = 9.65
- Sheet3.Columns(i + 1).ColumnWidth = 18.13
- Next
- For Each rng In Sheet1.Range("a2:a" & Sheet1.Cells(Rows.Count, 1).End(xlUp).Row)
- With Sheet3
- If c < 8 Then
- With .Range(.Cells(r, c), .Cells(r + 2, c + 1))
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = True
- .ReadingOrder = xlContext
- .Borders(xlDiagonalDown).LineStyle = xlNone
- .Borders(xlDiagonalUp).LineStyle = xlNone
- With .Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = xlAutomatic
- .TintAndShade = 0
- .Weight = xlMedium
- End With
- With .Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = xlAutomatic
- .TintAndShade = 0
- .Weight = xlMedium
- End With
- With .Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = xlAutomatic
- .TintAndShade = 0
- .Weight = xlMedium
- End With
- With .Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = xlAutomatic
- .TintAndShade = 0
- .Weight = xlMedium
- End With
- With .Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = xlAutomatic
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With .Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = xlAutomatic
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With .Font
- .Name = "標楷體"
- End With
- End With
- With .Range(.Cells(r, c), .Cells(r, c + 1))
- .MergeCells = True
- .Value = "XX企業股份有限公司"
- With .Font
- .Size = 14
- End With
- End With
- .Cells(r + 1, c) = "財產編碼"
- .Cells(r + 1, c + 1) = rng
- .Cells(r + 2, c) = "品名"
- .Cells(r + 2, c + 1) = rng.Offset(, 1)
- c = c + 2
- End If
- If c > 8 Then
- c = 1
- r = r + 3
- End If
- End With
- Next
- End Sub
複製代碼 |
|
|
|
|
|
|
|
- 帖子
- 552
- 主題
- 6
- 精華
- 0
- 積分
- 576
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- office 2010
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2015-2-8
- 最後登錄
- 2026-9-10
  
|
回復 4# poke0817
製作儲存格格式,和版本有關係!2003不相容! |
|
|
|
|
|
|
|