LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Change event code Find .Activate does not activate Target.value

If I enter a number on sheet 1 I want to know if it exist on any of the sheets in the array.

As is, if I enter 2468 on sheet 1 it runs through the array sheets but does not activate the number 2468 on sheet 4 which I am using for the test. The other sheets have no matching number in my test.

I can un-comment the MsgBox and it verifies "CheckNum" as the sheets are tested, but nothing happens on sheet 4 where there is indeed a true match to CheckNum.

If I run the Macro 8 sub in sheet 4 module it selects the 2468 as I would expect from both it and the change event.

If I try this line I get an yellow highlight error. Doesn't want the . in front of UsedRange.

.UsedRange.Find(What:=CheckNum).Activate

My ultimate goal is to produce a MsgBox on sheet 1 telling the user that the number exists on ...Sheet 3 $D:$6, for example or "Not Found".

Gotta get past this elusive Find code first.

Thanks,
Howard

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

Dim CheckNum As Long
Dim varSheets As Variant
Dim i As Long

CheckNum = Target.Value

varSheets = Array("Sheet2", "Sheet3", "Sheet4")

For i = LBound(varSheets) To UBound(varSheets)
With Sheets(varSheets(i))
'MsgBox CheckNum
UsedRange.Find(What:=CheckNum).Activate

End With
Next
End Sub



Option Explicit

Sub Macro8()
Dim CheckNum As Long
CheckNum = 2468
With Sheets("Sheet4")
UsedRange.Find(What:=CheckNum).Activate
End With
End Sub
 
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
VBA code to find first blank cell in a column and activate it Wes_A[_2_] Excel Programming 5 April 4th 23 12:54 PM
closing another file by code causes failure to run workbook activate event [email protected] Excel Programming 2 July 12th 12 02:07 PM
Reliably activate PowerPoint, do something, Activate Excel Barb Reinhardt Excel Programming 1 December 4th 08 09:42 PM
Event Macro - On Cell Activate - Change Cell Format [email protected][_2_] Excel Programming 7 November 7th 07 03:36 AM
Cell value Change Event - Need to activate macro Listbox use in Excel Excel Programming 4 July 26th 05 08:28 PM


All times are GMT +1. The time now is 01:33 PM.

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"