Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Morning!
I am doing a little program that would fetch information to a set of sheets, which works OK now. Problem is with checking if the data has been previously fetched, then it should overwrite existing data instead of creating a new set. How do you check if exists stuff in excel. Basic idea. If exists (name) then write to name else new sheet with (name) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I found this UDF in the forum, I forgot the name of the author, sorry!
Public Function WSExist(wsname As String) As Boolean 'returns true if worksheet exists in the active workbook Dim objWorksheet As Object On Error Resume Next WSExist = False Set objWorksheet = ActiveWorkbook.Sheets(wsname ) If Err = 0 Then WSExist = True End Function Regards, Stefi €˛KtM€¯ ezt Ć*rta: Morning! I am doing a little program that would fetch information to a set of sheets, which works OK now. Problem is with checking if the data has been previously fetched, then it should overwrite existing data instead of creating a new set. How do you check if exists stuff in excel. Basic idea. If exists (name) then write to name else new sheet with (name) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a sheet check function that you can incorporate
'----------------------------------------------------------------- Function SheetExists(Sh As String, _ Optional wb As Workbook) As Boolean '----------------------------------------------------------------- Dim oWs As Worksheet If wb Is Nothing Then Set wb = ActiveWorkbook On Error Resume Next SheetExists = CBool(Not wb.Worksheets(Sh) Is Nothing) On Error GoTo 0 End Function -- HTH Bob Phillips (remove nothere from email address if mailing direct) "KtM" wrote in message oups.com... Morning! I am doing a little program that would fetch information to a set of sheets, which works OK now. Problem is with checking if the data has been previously fetched, then it should overwrite existing data instead of creating a new set. How do you check if exists stuff in excel. Basic idea. If exists (name) then write to name else new sheet with (name) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for both replies, both work nicely. Thanks!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Checking for the existence of a worksheet | Excel Discussion (Misc queries) | |||
Checking to see if a worksheet exists | Excel Programming | |||
How do I conditionally build worksheet from existing worksheet? | Excel Discussion (Misc queries) | |||
Checking whether a worksheet exist or not | Excel Programming | |||
Checking whether a worksheet exist or not | Excel Programming |