ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   missing worksheet (https://www.excelbanter.com/excel-worksheet-functions/87227-missing-worksheet.html)

Smitty

missing worksheet
 
In a worksheet (1) I want to search for the existence of another worksheet
(2). If found, I want to extract the value from that worksheet(2) into a cell
in the active worksheet (1). If not found I want to default to the value that
already exists in the cell in the active worksheet (1).



Don Guillett

missing worksheet
 
try this. However, it not exist it gets the value from another cell. To use
the value from the SAME cell, you need a UDF macro

=IF(ISERROR(INDIRECT("'joe'!A1")),H1,INDIRECT("joe !A1"))

--
Don Guillett
SalesAid Software

"Smitty" <Smitty @discussions.microsoft.com wrote in message
...
In a worksheet (1) I want to search for the existence of another worksheet
(2). If found, I want to extract the value from that worksheet(2) into a
cell
in the active worksheet (1). If not found I want to default to the value
that
already exists in the cell in the active worksheet (1).





Otto Moehrbach

missing worksheet
 
The following macro will do what you want. As written, the macro will check
if sheet "Two" exists. If it does, it will copy F1 of sheet "Two" and paste
it to A1 of the active sheet. If sheet "Two" does not exist it will do
nothing. HTH Otto
Sub GetData()
Dim wsh As Worksheet
On Error Resume Next
Set wsh = ActiveWorkbook.Worksheets("Two")
If Err < 0 Then Exit Sub
Range("A1").Value = Sheets("Two").Range("F1").Value
End Sub
"Smitty" <Smitty @discussions.microsoft.com wrote in message
...
In a worksheet (1) I want to search for the existence of another worksheet
(2). If found, I want to extract the value from that worksheet(2) into a
cell
in the active worksheet (1). If not found I want to default to the value
that
already exists in the cell in the active worksheet (1).





Lau

missing worksheet
 
I works. Great!



All times are GMT +1. The time now is 02:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com