PDA

View Full Version : compare value from notepad with value in excel



raghavarock
10-19-2016, 01:48 AM
Hi there,

Can we compare a value in notepad (value in notepad is "2017.3") with value in Sheet1.range(B5) and if true a msg saying "match" else Msg as "doesn't match"
Note pad is saved in Desktop and it have only text ("2017.3"). without opening notepad file.


Appreciate you help in this regard.

JKwan
10-19-2016, 12:07 PM
give this a try


Sub ReadFile()
Dim Data As Double
Data = CreateObject("scripting.filesystemobject").opentextfile( _
"c:\Your Path\Desktop\TextFile.txt").readall
If Data = ThisWorkbook.Worksheets("Sheet1").Range("B5") Then
MsgBox "Matched"
Else
MsgBox "Does not Match"
End If
End Sub