Results 1 to 6 of 6

If Column A contains one of several strings then change column Bs string

Threaded View

Vestax159 If Column A contains one of... 01-04-2010, 11:01 PM
JBeaucaire Re: If Column A contains one... 01-04-2010, 11:52 PM
Vestax159 Re: If Column A contains one... 01-05-2010, 12:16 AM
JBeaucaire Re: If Column A contains one... 01-05-2010, 04:35 AM
Vestax159 Re: If Column A contains one... 01-05-2010, 06:46 PM
JBeaucaire Re: If Column A contains one... 01-05-2010, 07:31 PM
  1. #1
    Registered User
    Join Date
    01-04-2010
    Location
    Virginia
    MS-Off Ver
    Excel 2003
    Posts
    11

    If Column A contains one of several strings then change column Bs string

    I am fairly new to macros in excel however I have done programming before. My biggest problem is figuring out the syntax for everything. So wondering if you guys could give me a hand.

    What I need is to check to see if a cell in a column matches one of several different strings. If it does then I need to change another cell in the same row but different column to say DELETE. If it does not contain that string then I simple delete it So far I have this

    Sub Loop_WIP()
        Dim First As Long
        Dim Last As Long
        Dim Lrow As Long
    
    
            First = .UsedRange.Cells(1).Row
            Last = .UsedRange.Rows(.UsedRange.Rows.Count).Row
    
            For Lrow = Last To First Step -1
    
                With .Cells(Lrow, "A")
    
                    If Not IsError(.Value) Then
    
                        If .Value = "ItemA" or "ItemB" or "ItemC" Then
    
                            Change Value of Column B same Row
                        Else
                            .EntireRow.Delete
    
                    End If
    
                End With
    
            Next Lrow
    
        End With
    
    End Sub
    Alternatively I could delete all of the un needed rows then go back with another macro to change all of row B to say DELETED. I still face the problem of not knowing how to format a cell change.
    Last edited by Vestax159; 01-04-2010 at 11:49 PM.

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