HI.,
i am trying to copy & paste the range of columns to two columns with specified criteria., Attached herewith the code so far.
the table consist of 6 columns. the first four columns are code nos with corresponding value in the last two column. i am trying to populate the following.
- first column to be placed in a certain location.
- the second column to be placed below the first column.
- the third column below the second column
- the fourth column below the third column.
- The value in the fifth column to be placed next column of the first column placed in sl.no:01
- the same value is placed again below the values pasted in the sl.no:5.
- The value in the sixth column to be placed below the sl.no:06
- the same value (sixth column) is placed again below the values pasted in the sl.no:7
the code i tried below, able to achieve upto sl.no:6
Public Sub edgeband()
Dim x As Integer
Dim y As Integer ' column variable
Dim k As Integer ' column variable
Dim m As Integer ' column variable
Dim lngLastRow As Long
Dim lngLast As Long
m = 14
'to find the last row in the column.
'lry = Cells.Find("*", Cells(1, 1), xlFormulas, xlPart, xlByRows,xlPrevious, False).Row
lngLastRow = Cells(Rows.Count, "F").End(xlUp).Row
Z = 13 ' destination column
x = 3 'row no
y = 6 ' column no
k = 3
' toclear the last row
For y = 6 To 9
Range(Cells(x, y), Cells(lngLastRow, y)).Copy
Cells(k, Z).PasteSpecial xlPasteValues ' destination column
k = Cells(Rows.Count, Z).End(xlUp).Row + 1
Next y
Z = Z + 1
k = 3
For m = m To m + 2
Range(Cells(k, y), Cells(lngLastRow, y)).Copy
Cells(k, Z).PasteSpecial xlPasteValues
k = Cells(Rows.Count, Z).End(xlUp).Row + 1
Cells(k, Z).PasteSpecial xlPasteValues
y = y + 1
m = m + 1
x = 3
k = Cells(Rows.Count, Z).End(xlUp).Row + 1
Next m
Application.CutCopyMode = False[attach=1228611][/attach]
End Sub
Display More