+ Reply to Thread
Results 1 to 4 of 4

Create a macro to blank cells in a specific workbook - Excel 2003

Hybrid View

  1. #1
    Registered User
    Join Date
    03-09-2008
    Location
    Columbia, CT USA
    Posts
    5

    Create a macro to blank cells in a specific workbook - Excel 2003

    Hi -

    I was wondering if someone might be able to help. At work we use a spreadsheet template that we pass from group to group which contains (6) worksheets. One of the worksheets contains a number of cells which are confidential, and I'd prefer that infomation not be passed on to my group.

    I'd like to create a "button" (or macro) which would clear data from these specific cells on this specific worksheet before they are sent to my team. I'm a macro newbie, and I'd appreciate any assistance anyone could provide.

    Thanks in advance.
    Last edited by Elmer; 03-09-2008 at 11:21 PM.

  2. #2
    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
    Press Alt + F11 > insert module > paste in the below. Change sheet name and range to suit

    Sub ClearCells()
    Dim Rng As Range
    'Change Sheet name to your sheet Name
    'Change Range to your range e.g Range("A1:A10")
    Set Rng = Sheets("Sheet1").Range("E3,B1,A4,C7")
        Rng.ClearContents
    End Sub
    To run press Alt + F8

    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 !!!

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    Quote Originally Posted by Elmer
    Hi -

    I was wondering if someone might be able to help. At work we use a spreadheet template that we pass from group to group which contains (6) worksheets. One of the worksheets contains a number of cells which are confidential, and I'd prefer that infomation not be passed on to my group.

    I'd like to create a "button" (or macro) which would clear data from these specific cells on this specific worksheet before they are sent to my team. I'm a macro newbie, and I'd appreciate any assistance anyone could provide.

    Thanks in advance.
    Here's a link on starting the macro recorder
    http://www.exceltip.com/st/Using_the...Excel/627.html

  4. #4
    Registered User
    Join Date
    03-09-2008
    Location
    Columbia, CT USA
    Posts
    5

    Smile Thank You !!!!!

    Thank you - it worked like a champ!!!!! Your help is greatly appreciated.

+ 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