Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help. Find in sheetB a variable value from sheetA

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 "&quot" but I get a compiling error if I use that
syntax.
Could someone help me, please?

Thanks!
-Z
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Help. Find in sheetB a variable value from sheetA

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 "&quot" but I get a compiling error if I
use that
syntax.
Could someone help me, please?

Thanks!
-Z



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help. Find in sheetB a variable value from sheetA

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Find Joe Murphy[_2_] Excel Discussion (Misc queries) 1 January 7th 09 02:21 PM
How can I add rows to a table on SheetA & have SheetB's table upda birdpants Excel Discussion (Misc queries) 0 August 6th 07 10:10 PM
Dynamically create a formula in Sheet B referencing SheetA SHIPP Excel Programming 4 April 17th 05 04:11 PM
Find a variable ben Excel Programming 6 December 1st 04 07:27 PM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 02:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"