ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data check (https://www.excelbanter.com/excel-programming/367137-data-check.html)

Brian Matlack[_107_]

Data check
 

Hi!
I would like to check, to see if the text in column "a" in this cod
exists in the range "data1" before proceeding on with the code. Thi
loop may involve several dozen rows only 3 or 4 of which will have dat
in column "k" but I want to verify that there is a valid name in colum
"a" of that row before copying the data to another range.
<start code
Sheets("sheet1").Select
For i = 1 To Cells(Rows.Count, "k").End(xlUp).Row
If Cells(i, "k").Value < "" Then
Cells(i, "n").Value = Cells(i, "a").Value
Cells(i, "o").Value = Cells(i, "b").Value
Cells(i, "p").Value = Cells(i, "c").Value
End If
Next i
<end code
Hope someone can help stear me in the right direction!!
Thanks for your time!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=56121


Tom Ogilvy

Data check
 
Sheets("sheet1").Select
For i = 1 To Cells(Rows.Count, "k").End(xlUp).Row
If Cells(i, "k").Value < "" and application.Countif( _
Range("Data1"),Cells(i,"A")) 0 Then
Cells(i, "n").Value = Cells(i, "a").Value
Cells(i, "o").Value = Cells(i, "b").Value
Cells(i, "p").Value = Cells(i, "c").Value
End If
Next i

--
Regards,
Tom Ogilvy


"Brian Matlack" wrote:


Hi!
I would like to check, to see if the text in column "a" in this code
exists in the range "data1" before proceeding on with the code. This
loop may involve several dozen rows only 3 or 4 of which will have data
in column "k" but I want to verify that there is a valid name in column
"a" of that row before copying the data to another range.
<start code
Sheets("sheet1").Select
For i = 1 To Cells(Rows.Count, "k").End(xlUp).Row
If Cells(i, "k").Value < "" Then
Cells(i, "n").Value = Cells(i, "a").Value
Cells(i, "o").Value = Cells(i, "b").Value
Cells(i, "p").Value = Cells(i, "c").Value
End If
Next i
<end code
Hope someone can help stear me in the right direction!!
Thanks for your time!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=561213



Brian Matlack[_108_]

Data check
 

Very Cool Tom!!!
Thanks alot!!!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=56121



All times are GMT +1. The time now is 01:29 PM.

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