+ Reply to Thread
Results 1 to 7 of 7

if sheet 9 exists, clear it otherwise create one

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    if sheet 9 exists, clear it otherwise create one

    run macro1 and note that the below code is not working
    If Not sh Is Nothing Then
    Attached Files Attached Files

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: if sheet 9 exists, clear it otherwise create one

    You may try this.....
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: if sheet 9 exists, clear it otherwise create one

    sloved with thanks

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: if sheet 9 exists, clear it otherwise create one

    You're welcome.
    If that takes care of your question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.
    Moreover you may also click on * (star) to Add Reputation if the solution provided helped you. This is another way to say thanks.

  5. #5
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: if sheet 9 exists, clear it otherwise create one

    [QUOTE=sktneer;3818980]You may try this.....
    [CODE]
    Sub Macro1()
    Dim sh As Worksheet
    On Error Resume Next
    Set sh = Worksheets("Sheet9")
    On Error GoTo 0
    If Not sh Is Nothing Then
    sh.UsedRange.ClearContents
    Sheets("Sheet1").Range("A:B").Copy sh.Range("A1")
    Else

    plse see Snap1.png
    if run macro from sheet named djia, it is not working
    Attached Images Attached Images

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: if sheet 9 exists, clear it otherwise create one

    In that case you may use the code like this.....
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-13-2006
    Posts
    87

    Re: if sheet 9 exists, clear it otherwise create one


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 11
    Last Post: 03-14-2014, 08:06 AM
  2. [SOLVED] check if sheet exists, if not then create
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2013, 06:12 AM
  3. Code to clear contents of specific cells based upon if key exists in other sheets
    By seputus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 07:25 PM
  4. Clear Contents on Update when other code exists in the Worksheet_Change thingy
    By JRS_ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2011, 12:11 PM
  5. [SOLVED] If Sheet exists, GOTHERE, else create it
    By CLR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2005, 03:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1