Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Want delete rows if A have value and O not

Hello!
Can somebody help me with this. Here is how much I have done.
t. Kari

Sub deleteemptyrows()
Do
Set tamarivi = Rows("2:2")
Set solu1 = Range("A2")
Set solu2 = Range("O2")
Rows("2:2").Select
If Not solu1 = Empty And solu2 = Empty Then
MsgBox "A2 sisältää arvon ja O2 ei", vbOKOnly, "Poista rivi"
tamarivi.EntireRow.Delete
Set tamarivi = Rows("2:2")
Set solu1 = Range("A2")
Set solu2 = Range("O2")
Else
If IsEmpty(solu1) And IsEmpty(solu2) Then
MsgBox "A2 ja O2 on tyhjiä", vbOKOnly, "Lopeta ohjelma"
Exit Sub
Else
If Not solu1 = Empty Or solu2 = Empty Then
MsgBox "A2 ja O2 sisältää kumpikin arvon", vbOKOnly, "Jatka ohjelmaa"
Set seurrivi = tamarivi.Offset(1, 0)
End If
End If
End If
Loop Until solu1 = Empty
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Want delete rows if A have value and O not


Do you want to delete all rows where there is a value in Column A but no
value in column O? if this is the case this will do what you need, of
course you need to change the language!

Sub del_rows()
Dim Rng As Range
Dim cRow
Dim i
Application.ScreenUpdating = False
cRow = Range("A" & Rows.Count).Row
For i = 2 To cRow
If Range("A" & i).Value < "" And Range("O" & i).Value = "" Then
Range("A" & i).EntireRow.Delete
End If
Next i
Application.ScreenUpdating = True
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=30861

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Want delete rows if A have value and O not

Sorry my bad english. Yor code works thank you but I need script that delete
other rows but those who have in same time value in A and O.
Regards Kari

"Simon Lloyd" wrote:


Do you want to delete all rows where there is a value in Column A but no
value in column O? if this is the case this will do what you need, of
course you need to change the language!

Sub del_rows()
Dim Rng As Range
Dim cRow
Dim i
Application.ScreenUpdating = False
cRow = Range("A" & Rows.Count).Row
For i = 2 To cRow
If Range("A" & i).Value < "" And Range("O" & i).Value = "" Then
Range("A" & i).EntireRow.Delete
End If
Next i
Application.ScreenUpdating = True
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=30861


Reply
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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Copy pasting Rows, but need to Delete any Shapes/Pictures that are within copied rows Corey Excel Programming 2 August 1st 07 02:02 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 02:47 PM.

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

About Us

"It's about Microsoft Excel"