equivalent for excel macro

stanley

New member
Joined
Aug 3, 2009
Messages
4
Programming Experience
5-10
can someone tell me what would be the equivalent vb.net code for the below excel macro code:

Selection.Find(What:="FALSE", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

I have changed the code to

ObjWs1.Application.Selection.Find(What:="FALSE", After:=ObjWs1.Application.ActiveCell, LookIn:=Microsoft.Office.Interop.Excel.XlFindLookIn.xlFormulas, _
LookAt:=Microsoft.Office.Interop.Excel.XlLookAt.xlPart, SearchOrder:=Microsoft.Office.Interop.Excel.XlSearchOrder.xlByRows, SearchDirection:=Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext, _
MatchCase:=False, SearchFormat:=False).Activate()

when I run this code I am getting an error and the description is:
"Object variable or With block variable not set"

Thanks.
 

actually i am looking for a string "False" in the excel sheet and if found it has to be replaced with " ".

The excel code is:

Selection.Find(What:="FALSE", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,MatchCase:=False, SearchFormat:=False).Activate()

Selection.Replace(What:="FALSE", Replacement:=" ", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False)


I want the equivalent code in VB.NET for the abobe.

Can someone pls help me?

Thanks.
 
Back
Top