ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding Blanks in list (https://www.excelbanter.com/excel-programming/293800-finding-blanks-list.html)

Jahsonn

Finding Blanks in list
 
I have a list of data as such.

112526 name
254412 name

125421 name
254412 name

254412

The first column will always have a value in it but the
second and third columns may not have values in them. Is
it possible to have a macro run down the list and any
items which it doesnt have values in columns b and c to
copy to another sheet?



Edward Ulle

Finding Blanks in list
 
Try this

Option Explicit

Public Sub Test()

Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim iRow As Integer
Dim jRow As Integer

Set wsSource = Worksheets("Source")
Set wsDest = Worksheets("Dest")

iRow = 0
jRow = 0
Do While Not IsEmpty(wsSource.Range("A1").Offset(iRow, 0))
If IsEmpty(wsSource.Range("A1").Offset(iRow, 1)) Then
iRow = iRow + 1
jRow = jRow + 1
wsSource.Rows(iRow).Copy (wsDest.Rows(jRow))
ElseIf IsEmpty(wsSource.Range("A1").Offset(iRow, 2)) Then
iRow = iRow + 1
jRow = jRow + 1
wsSource.Rows(iRow).Copy (wsDest.Rows(jRow))
Else
iRow = iRow + 1
End If
Loop

End Sub




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 02:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com