Hey every one i just new in VBA and i need your help as welli have row data file of serial numbers with product name and i want to open it and show data as well in excel with vba here is the sample:
i want to be like this
i use below codes to open serial numbers :
Then i put all the into single column with this code
i know there should be more easy way to manage this then i would like to ask your help to have easier code,for more detail name of product put in A column , serial start from in B column , Serial End to in C column,thanks for your kind ideas
Code:
Sub ExpandSeries() Dim RR$, R&, C As Range Application.ScreenUpdating = 0 R = Range("A1").CurrentRegion.Rows.Count RR = "D1" ' Place to Write Results With Range(RR) .CurrentRegion.ClearContents ' Clear previous Results .Resize(2, R) = Application.Transpose(Range("A1").CurrentRegion) .Offset(2).Resize(, R) = "Series" .Offset(3).Resize(, R) = .Resize(, R).Value For Each C In .Offset(3).Resize(, R) C.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Step:=1, Stop:=C.Offset(-2) Next C .CurrentRegion.Columns.AutoFit End With Application.ScreenUpdating = 1End Sub
Code:
Sub test()Dim LR As Long, i As LongFor i = 2 To 400 LR = Cells(Rows.Count, i).End(xlUp).Row Range(Cells(1, i), Cells(LR, i)).Copy Destination:=Cells(Rows.Count, 1).End(xlUp).Offset(1)Next iEnd Sub