|
- Sub Test()
- Dim SH As Worksheet
- Dim lngRow_start As Long, lngRow_end As Long
- Dim lngRow As Long, lngCol As Long
- Dim arrSource As Variant
-
- Set SH = Sheets("Sheet1")
- lngRow_start = Sheet1.UsedRange.Row
- lngRow_end = Sheet1.UsedRange.Rows.Count + Sheet1.UsedRange.Row - 1
-
- arrSource = SH.Range("A" & lngRow_start & ":N" & lngRow_end)
-
- '假设有效区域第一行为 标题
- For lngRow = 2 To UBound(arrSource)
- '如果N列不为空,B列=N列
- If arrSource(lngRow, 14) <> "" Then arrSource(lngRow, 2) = arrSource(lngRow, 14)
- Next
-
- SH.Range("A" & lngRow_start & ":N" & lngRow_end) = arrSource
- End Sub
复制代码 |
|