View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Junior728 Junior728 is offline
external usenet poster
 
Posts: 44
Default To repeat data row after row.

Hi Sir,

i am trying to extract data from a cell and then return the data into
designated cell. i try to return the data into the next row of cell by
trying to offset to the next row but unsuccessful. See my example,

The problem is: the loop thing still works except that it does not go to the
next empty row/cell for me. it keep on loop at Row1 and non-stop. Where
should i put my Exit Loop if i want it to end after the macro detect no more
data? Pls advise.


Example:

Sub( )

Range("A1").Select
i = ActiveCell.Offset(1, 0).Select

Do Until i = ""

'Line Number
Cells(i, 3).Select
ActiveCell.FormulaR1C1 = _
"=IF(MID(R[5]C[-2],2,1)=""0"",TRIM(MID(R[5]C[-2],2,2))*1,""Z"")"

'Quantity
Cells(i, 4).Select
ActiveCell.FormulaR1C1 = _
"=IF(MID(R[5]C[-3],2,1)=""0"",TRIM(MID(R[5]C[-3],48,7))*1,""Z"")"

'Purchase Order
Cells(i, 5).Select
ActiveCell.FormulaR1C1 = _
"=IF(MID(R[5]C[-4],2,1)=""0"",TRIM(MID(R[5]C[-4],5,7))*1,""Z"")"

'Acknowledgement Status
Cells(i, 6).Select
ActiveCell.FormulaR1C1 = _
"=IF(MID(R[5]C[-5],2,1)=""0"",TRIM(MID(R[5]C[-5],46,1)),""Z"")"

'Part No
Cells(i, 7).Select
ActiveCell.FormulaR1C1 = _
"=IF(MID(R[1]C[-6],2,4)=""PODT"",TRIM(MID(R[1]C[-6],10,29)),""Z"")"

Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

'Delete for Next PN
Range("A1:A26").Select
Range("A26").Activate
Selection.Delete Shift:=xlUp

Loop

End Sub( )