View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Zygoid[_9_] Zygoid[_9_] is offline
external usenet poster
 
Posts: 1
Default what does (ByVal Target As Range) mean

Thanks again for a reply! someone had given a suggestion to change the
code to this

With Target(1)
If Union(Target, Range("A1:A50")).Address = "$A$1:$A$50" Then
If .Value < "" Then
Application.ScreenUpdating = False
Set SourceWB = Workbooks.Open("path\to\workbook")
ActiveWorkbook.Sheets("1").Activate
If Sheets("1").Range("A1:A50").Find( _
What:=.Value) Is Nothing Then
SourceWB.Close True
FORM.Show 'rename form to fit
End If
End If
End If
End With

This works great to open the form if text in cell is not listed, but I
have discovered another problem..

if the text in the cell is listed, the sourceWB will not close. it
stays open and is activated.

i figured i would need to add something like

If Sheets("1").Range("A1:A50").Find( _
What:=.Value) Is Something Then
SourceWB.Close True
end if

I have tried many variations by changing the word "nothing"
but it doesn't work. Any suggestions?


---
Message posted from http://www.ExcelForum.com/