Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using this in workbook(1) to search text in cell D3 in a range of
workbook(2). if the text in D3 is not found in the range of wb2 then a form opens up to - add information into wb2, save the changes in wb2, and then close wb2. this all works fine. Private Sub Worksheet_Change(ByVal Target As Range) With Target(1) If .Address = "$D$3" Then If .Value < "" Then Application.ScreenUpdating = False Set sourcewb = Workbooks.Open("path/to/wb2") ActiveWorkbook.Sheets("1").Activate If Sheets("1").Range("A1:A200").Find( _ what:=.Value) Is Nothing Then sourcewb.Close True FORM.Show End If End If End If End With the problem is that if D3 is found in wb2. wb2 doesn't close. i am guessing i need an ElseIf but not sure how to code it. any idea's? --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See one possible answer in your previous thread:
"what does (ByVal Target As Excel.Range)" mean" In article , Zygoid wrote: I am using this in workbook(1) to search text in cell D3 in a range of workbook(2). if the text in D3 is not found in the range of wb2 then a form opens up to - add information into wb2, save the changes in wb2, and then close wb2. this all works fine. Private Sub Worksheet_Change(ByVal Target As Range) With Target(1) If .Address = "$D$3" Then If .Value < "" Then Application.ScreenUpdating = False Set sourcewb = Workbooks.Open("path/to/wb2") ActiveWorkbook.Sheets("1").Activate If Sheets("1").Range("A1:A200").Find( _ what:=.Value) Is Nothing Then sourcewb.Close True FORM.Show End If End If End If End With the problem is that if D3 is found in wb2. wb2 doesn't close. i am guessing i need an ElseIf but not sure how to code it. any idea's? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Problem viewing Excel 2003 Pivot Chart fields in Excel 2007 | Charts and Charting in Excel | |||
Weird problem with Excel 2000...Worksheets disappearing in a shared Excel file | Excel Discussion (Misc queries) | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
EXCEL FORMAT PROBLEM WHEN SENDING EXCEL SHEET AS MESSAGE BODY IN . | Excel Discussion (Misc queries) |