vba编辑,选定sheet1里某单元格,其单元格后面所有数值,都在sheet2里第一行显示。 100
1个回答
展开全部
Sub Test()
Dim sht1 As Worksheet, sht2 As Worksheet
Dim myCell As Range, rng As Range
Set sht1 = Worksheets(1)
Set sht2 = Worksheets(2)
With sht2.Cells(1, 1).CurrentRegion
Set rng = sht2.Cells(2, 2).Resize(.Rows.Count - 1, .Columns.Count - 1)
End With
For Each myCell In rng.SpecialCells(xlCellTypeConstants)
With myCell
sht1.Cells(.Row, .Column) = .Value
End With
Next myCell
End Sub
详见附件。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询