+ Reply to Thread
Results 1 to 5 of 5

Clear cell (VBA code)

  1. #1
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201

    Clear cell (VBA code)

    Hi,

    using the following code to clear cells on opening a workbook, however it only clears cells on 1 tab, i want to be able to clear cells from different tabs in the same workbook. Any ideas?

    a = MsgBox("WOULD YOU LIKE A BLANK FORM ?", vbYesNo)
    If a = vbYes Then Cancel = Range( _" "). _
    Select
    Selection.ClearContents


    thanks

  2. #2
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201
    Hi,

    not sure if i made it clear. Basically when a user opens the excel document they are asked if they, "would like a blank form", if yes it delete's the data from the cells identified between the "" marks. It however only deletes the cells in the first tab. I basically need to know how when identifying the cells to delete how i can tell it what tab to delete the cells from,

    any ideas??

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Try adding your code to the below

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201
    Hi,

    thanks, but now sure it does what i need it to.

    Basically when the user opens the file they are asked the quesiton "WOULD YOU LIKE A BLANK FORM ?" (msg box) if the user clicks on yes (they want a blank form) then the code deletes cells A1 and C1 on sheet 1 and deletes cell B2 and D3 on Sheet 2,

    any ideas??

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If only four cells can't you just clear the content

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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