Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If, Then, Cut, Paste, Delete HELP
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! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
check box, copy / paste or insert / delete row | Excel Worksheet Functions | |||
Macro to cut/paste/delete | Excel Discussion (Misc queries) | |||
copy paste delete cell contents | Excel Discussion (Misc queries) | |||
Macro to copy, paste in a range and then delete | Excel Discussion (Misc queries) | |||
Find, Cut, Paste and Delete | Excel Worksheet Functions |