You might try something like:
Sub Correct_Rows()
If Cells(2, 2) = 16210 Then
Dim MyRowNumber As Integer
Dim MyColumnNumber As Integer
MyRowNumber = 2
MyColumnNumber = 2
'cut cells in Range B2 to V2)
Range(Cells(MyRowNumber, MyColumnNumber), Cells(MyRowNumber,
MyColumnNumber + 20)).Cut
'Move up 1 row and move 4 columns to the right.
Cells(MyRowNumber - 1, MyColumnNumber + 4).Select
ActiveSheet.Paste
Rows(2).EntireRow.Delete
ElseIf Cells(2, 2) = "PO" Then
Rows(2).EntireRow.Delete
End If
End Sub
You can use the macro recorder as a very useful tool in writing the code.
Hope this helps.
Ron Dahl
"stephanie spomer" wrote in message
...
I am trying to accomplish the following in Excel:
Sub Correct_Rows()
if B2 = 16210 Then
Cut cells B2:V2
Move Up 1 Row
Move Over 4 Columns
Past cells
Delete Row 2
ElseIf B2 = "PO" Then
Delete Row 2
End If
Scroll thru rest of rows in Column B and repeat.
End Sub
The size of the worksheet will vary each time the macro is run, so it
must be dynamic. Column B will always be the column checked and the cut
and paste will always be "cut n, paste n-1, four columns over.
See? I have been trying desperately to build this and CANNOT figure out
how to use the debug (or any of the tools). I just assume that when it's
right, it will do what i need.
Any help is greatly appreciated!!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!