+ Reply to Thread
Results 1 to 3 of 3

Macro to clear contents

  1. #1
    Forum Contributor
    Join Date
    04-30-2011
    Location
    wirral,england
    MS-Off Ver
    Excel 2010
    Posts
    148

    Smile Macro to clear contents

    Hello all
    I have a spreadsheet around 70000 rows long,i would like to use a macro to do the following.If any cell in Col AB contains "first" then clear the contents from Columns AK,AL,AM in the specific rows where Col AB contains "first".The cols AK,AL,AM contain numeric data only.Many thanks for help given.
    Last edited by bigband1; 09-03-2011 at 03:13 AM.

  2. #2
    Registered User
    Join Date
    04-18-2011
    Location
    Surrey, UK
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Macro to clear contents

    Hi bigband,

    So what have you tried so far? Did it work?

    I would use a sub of the format:

    Please Login or Register  to view this content.
    This assumes that your data starts on row 1, and that your sheet is called sheet1.

    Hopefully will get you started!

    Kind regards,

    Paul

    Edit: Note that if your cell value in column AB starts with the word first, then Instr returns 0, which means that the macro will not clear the data. For example:

    4373first would return a value greater than zero when you test Instr(), but
    first43425 would return 0.

    so in the top case the cell contents would get cleared, and in the bottom case they wouldnt. You could make it clear the cell contents in any case by having something like:

    If InStr(testcell, "first") > 0 or testcell = "first" Then

    Happy coding!
    Last edited by PaulG2011; 09-02-2011 at 06:41 AM.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro to clear contents

    Depends on the data layout but autofilter would be the quickest way. Automate with VBA if realy necessary
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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