Results 1 to 2 of 2

Thread: Clear Content Scripts??

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    1

    Clear Content Scripts??

    Hi everyone,
    would you like to help me??

    In sheet 1, I must find the word "POPULATION",after that I must clear content all row below until row 99 because in row 100 the word "AVERAGE" is not allowed to be cleared/deleted. How to make clear content process stop automatically when it reach row 99. How to make by DO WHILE LOOP, FOR NEXT or any other solutions because I am a beginner in VBA.

    And so on until sheet 10
    Thank your for your suggestion

  2. #2
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Clear Content Scripts??

    Hi and Welcome,

    I Take it you know which column this will appear?? And are you wanting the information removing, or the entire row?

    VB Code:
    1. 'Set the cell below population
    2.   Do While ActiveCell.Row < 99
    3.     ActiveCell.EntireRow.Clear
    4.     ActiveCell.OffSet(1,0).Select
    5.   Loop

    Or

    VB Code:
    1. Range("A2").Select
    2.   Do While ActiveCell.Value <> "AVERAGE"
    3.     ActiveCell.EntireRow.Delete
    4.   Loop

    However with the second one you will need to know the exact cell the word AVERAGE will appear in, and also move the cursor below the row containing POPULATION.

    To loop around the sheets do

    VB Code:
    1. Dim i As Integer
    2.   For i = 1 to 10
    3.     Sheets(i).Activate
    4.     'loop around Cells here
    5.   Next i
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

Posting Permissions

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



Click Here to Expand Forum to Full Width