S
stephanie spomer
I am trying to do the following (semi-pseudocode):
Dim row, column
For row = 2 and column = B
If B2 = 16210 Then
Cut cells B2:V2
row = row -1
column = F
paste cells
row = row+1
delete row
column = B
ElseIf B2 = "PO" Then
delete row
row = row + 1
End If
End For
That is what i'm trying to accomplish, this is what i have so far:
Sub FixOpenOrders()
Dim topCel As Range, bottomCel As Range, _
sourceRange As Range, targetRange As Range
Dim x As Integer, i As Integer, numofRows As Integer
Set topCel = Range("B2")
Set bottomCel = Range("B65536").End(xlUp)
Set sourceRange = Range(topCel, bottomCel)
Set targetRange = Range("F1, Z1")
numofRows = sourceRange.Rows.Count
x = 1
For i = 1 To numofRows
If Application.IsNumber(sourceRange(i)) Then
If sourceRange(i) = 16210 Then
targetRange(x) = sourceRange(i)
x = x + 1
ElseIf sourceRange(i) = "PO" Then
sourceRange(i).Rows.Select
Selection.Delete Shift:=xlUp
x = x + 1
End If
End If
Next
End Sub
Any help is appreciated
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Dim row, column
For row = 2 and column = B
If B2 = 16210 Then
Cut cells B2:V2
row = row -1
column = F
paste cells
row = row+1
delete row
column = B
ElseIf B2 = "PO" Then
delete row
row = row + 1
End If
End For
That is what i'm trying to accomplish, this is what i have so far:
Sub FixOpenOrders()
Dim topCel As Range, bottomCel As Range, _
sourceRange As Range, targetRange As Range
Dim x As Integer, i As Integer, numofRows As Integer
Set topCel = Range("B2")
Set bottomCel = Range("B65536").End(xlUp)
Set sourceRange = Range(topCel, bottomCel)
Set targetRange = Range("F1, Z1")
numofRows = sourceRange.Rows.Count
x = 1
For i = 1 To numofRows
If Application.IsNumber(sourceRange(i)) Then
If sourceRange(i) = 16210 Then
targetRange(x) = sourceRange(i)
x = x + 1
ElseIf sourceRange(i) = "PO" Then
sourceRange(i).Rows.Select
Selection.Delete Shift:=xlUp
x = x + 1
End If
End If
Next
End Sub
Any help is appreciated
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!