ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Marco program (https://www.excelbanter.com/excel-programming/358141-marco-program.html)

Freeman_100

Marco program
 

Hi guys

I am news in marcos programming and I like
- to compare two coloums (A, B) from 2 sheets
- i need to see weather any values in coloumn A are missing from clom
B

thanks for your help


--
Freeman_100
------------------------------------------------------------------------
Freeman_100's Profile: http://www.excelforum.com/member.php...o&userid=33208
View this thread: http://www.excelforum.com/showthread...hreadid=530241


Dave Peterson

Marco program
 
Maybe something like:

Option Explicit
Sub testme()

Dim myRngA As Range
Dim myRngB As Range
Dim myCell As Range
Dim res As Variant

With Worksheets("sheet1")
Set myRngA = .Range("A1", .Cells(.Rows.Count, "A").End(xlUp))
End With

With Worksheets("sheet2")
Set myRngB = .Range("A1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRngA.Cells
res = Application.Match(myCell.Value, myRngB, 0)
If IsError(res) Then
myCell.Offset(0, 1).Value = "Missing"
Else
myCell.Offset(0, 1).Value = "Ok"
End If
Next myCell

End Sub

will get you started.

Freeman_100 wrote:

Hi guys

I am news in marcos programming and I like
- to compare two coloums (A, B) from 2 sheets
- i need to see weather any values in coloumn A are missing from clom
B

thanks for your help

--
Freeman_100
------------------------------------------------------------------------
Freeman_100's Profile: http://www.excelforum.com/member.php...o&userid=33208
View this thread: http://www.excelforum.com/showthread...hreadid=530241


--

Dave Peterson


All times are GMT +1. The time now is 01:44 AM.

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