Copying workbooks
Sub test()
Dim s$
Dim rng As Range
'Item 1: the .Lookin property is just looking for some text
'So you can do your input box and then pass it to .Lookup as a
string
s = Application.InputBox("do something...", "do something...")
If s = False Then Exit Sub
'Item 2: if the sheet doesn't exist use the range in the other
sheet
Err.Clear
On Error Resume Next
Set rng = Sheets("Access Data").Range("A1")
If Err < 0 Then
'Sheets("Access Data") doesn't exist
Set rng = Sheets("Date - Access").Range("A1")
End If
On Error GoTo 0
Err.Clear
Debug.Print rng.Value
End Sub
HTH—Lonnie M.
|