انتقال اطلاعات یک ستون و تفکیک ان به ستون های مربوطه
نمونه فایل زیر test.xlsx
نمونه فایل زیر test.xlsx
=OFFSET($A$2;(ROW()-2)*7;)
Sub ConvertList()
Application.ScreenUpdating = False
Columns("A:A").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
Range("C:I").Select
Selection.Clear
Range("A1").Select
ActiveCell.Range("A1:A6").Select
Do Until IsEmpty(ActiveCell)
Selection.Copy
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Transpose:=True
ActiveCell.Offset(6, -2).Range("A1:A6").Select
Loop
Columns("c:I").Select
ActiveWorkbook.Worksheets("sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("sheet1").Sort.SortFields.Add Key:=Range( _
"C1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("sheet1").Sort
.SetRange Range("C:I")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("a1").Select
Application.ScreenUpdating = True
End Sub
کامنت