Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I'm am new, so please be patient. I need to find in SheetB/ColumnB, values of SheetA/ColumnB and if I fin them, I should delete them. Dim tcid As Integer tcid = ActiveCell.Value Cells.Find(What:=tcid, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ True, SearchFormat:=False).Activate I recorded a macro, but I get and error message. I read something about """ but I get a compiling error if I use that syntax. Could someone help me, please? Thanks! -Z |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your code will fail if the Find doesn't find what its looking
for, because there is nothing to activate. Instead of putting the Activate method at the end of the Find method, as your code does, use code like Dim FoundCell As Range Set FoundCell = Cells.Find(....) If FoundCell Is Nothing Then ' code for not found Else FoundCell.Activate End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "zuhnara" wrote in message ... Hello I'm am new, so please be patient. I need to find in SheetB/ColumnB, values of SheetA/ColumnB and if I fin them, I should delete them. Dim tcid As Integer tcid = ActiveCell.Value Cells.Find(What:=tcid, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ True, SearchFormat:=False).Activate I recorded a macro, but I get and error message. I read something about """ but I get a compiling error if I use that syntax. Could someone help me, please? Thanks! -Z |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That worked
Thank you very much! -Zuh "Chip Pearson" wrote: Your code will fail if the Find doesn't find what its looking for, because there is nothing to activate. Instead of putting the Activate method at the end of the Find method, as your code does, use code like Dim FoundCell As Range Set FoundCell = Cells.Find(....) If FoundCell Is Nothing Then ' code for not found Else FoundCell.Activate End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "zuhnara" wrote in message ... Hello I'm am new, so please be patient. I need to find in SheetB/ColumnB, values of SheetA/ColumnB and if I fin them, I should delete them. Dim tcid As Integer tcid = ActiveCell.Value Cells.Find(What:=tcid, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ True, SearchFormat:=False).Activate I recorded a macro, but I get and error message. I read something about """ but I get a compiling error if I use that syntax. Could someone help me, please? Thanks! -Z |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variable Find | Excel Discussion (Misc queries) | |||
How can I add rows to a table on SheetA & have SheetB's table upda | Excel Discussion (Misc queries) | |||
Dynamically create a formula in Sheet B referencing SheetA | Excel Programming | |||
Find a variable | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |