LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
check box, copy / paste or insert / delete row Carla Excel Worksheet Functions 2 June 4th 08 03:01 PM
Macro to cut/paste/delete Betty Csehi Excel Discussion (Misc queries) 3 June 27th 06 02:55 PM
copy paste delete cell contents Garry Excel Discussion (Misc queries) 0 March 27th 06 08:26 PM
Macro to copy, paste in a range and then delete Garry Excel Discussion (Misc queries) 0 March 23rd 06 07:37 PM
Find, Cut, Paste and Delete rollover99 via OfficeKB.com Excel Worksheet Functions 0 December 29th 05 10:59 PM


All times are GMT +1. The time now is 10:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"