+ Reply to Thread
Results 1 to 7 of 7

Clear the whole Row if on the column "A" a certain text is found

Hybrid View

Jangorage Clear the whole Row if on the... 09-16-2014, 10:38 AM
nathansav Re: Clear the whole Row if on... 09-16-2014, 10:38 AM
Jangorage Re: Clear the whole Row if on... 09-16-2014, 10:52 AM
nathansav Re: Clear the whole Row if on... 09-16-2014, 10:54 AM
AB33 Re: Clear the whole Row if on... 09-16-2014, 10:54 AM
Jangorage Re: Clear the whole Row if on... 09-16-2014, 11:01 AM
nathansav Re: Clear the whole Row if on... 09-17-2014, 04:25 AM
  1. #1
    Registered User
    Join Date
    09-15-2014
    Location
    Austria
    MS-Off Ver
    2007
    Posts
    10

    Clear the whole Row if on the column "A" a certain text is found

    Hey guys,

    I have a problem in clearing the whole row when on Column "A" a certain text, in this case "Planungsbedingung" is written.

    I did it like this:

    Dim cell As Range
    For Each cell In Intersect(Columns("A:GA"), ActiveSheet.UsedRange)
      If cell = "Planungsbedingung" Then
        cell = "Planungsbedingung"
        cell.Offset(0, 1).ClearContents
      End If
    Next cell
    the problem is it just clears 1 cell and I dont know how I can make it so that the whole row is cleared when he finds that Text on column "A"

    How do I select the whole Row with Offset? or do I need another command?

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Clear the whole Row if on the column "A" a certain text is found

    cell.Offset(0, 1).row.entirerow.delete
    will delete

    range(cell.Offset(0, 1), cell.Offset(x, 1)).clearcontents
    where x is the column number of the right hand column
    Last edited by nathansav; 09-16-2014 at 10:43 AM.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    09-15-2014
    Location
    Austria
    MS-Off Ver
    2007
    Posts
    10

    Re: Clear the whole Row if on the column "A" a certain text is found

    It worked, thank you so much :D

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Clear the whole Row if on the column "A" a certain text is found

    Knew it would Not a problem, enjoy!

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Clear the whole Row if on the column "A" a certain text is found

    Why do you need to use offset if the aim is to clear the entire row?
      cell.EntireRow.ClearContents

  6. #6
    Registered User
    Join Date
    09-15-2014
    Location
    Austria
    MS-Off Ver
    2007
    Posts
    10

    Re: Clear the whole Row if on the column "A" a certain text is found

    Oh yeah you are right I dont need Offset, it works either way, thank you though learned something again

  7. #7
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Clear the whole Row if on the column "A" a certain text is found

    I put the offset in, to enable you to just clear say a:e if needed.

    Enjoy

+ 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. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  2. Replies: 3
    Last Post: 04-14-2013, 11:53 PM
  3. Macro to copy and paste rows based on "text" found in Column A
    By balston2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2013, 12:35 PM
  4. Auto Color whole column when found text "Sunday"
    By Kenji in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-18-2009, 09:43 PM
  5. Replies: 2
    Last Post: 05-05-2008, 04:51 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