+ Reply to Thread
Results 1 to 5 of 5

If Column A contains "Ohio" then offset by 3 cell....

  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2013
    Posts
    27

    If Column A contains "Ohio" then offset by 3 cell....

    I am looking to create a Macro that says: look at all of the data in column E:E and if you find a cell that has the word "Ohio" in the string of information, then offset that cell by 3 to the right and make that cell equal to "4"

    Sub Test()

    Columns("E:E").Select
    Dim rng As Range, cell As Range
    Dim worksh As Worksheet
    Set worksh = Worksheets("Axys Layout")
    Set rng = Range("E:E")
    For Each cell In rng
    If InStr(1, cell, "Ohio", 1) Then
    cell.Offset(, 3).Value = 4
    End If
    Next Ecell


    End Sub

    This is not working and I'm not even sure that I am on the right track! Any advice would be appreciated!!

    Thanks,
    Shannon

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: If Column A contains "Ohio" then offset by 3 cell....

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-21-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: If Column A contains "Ohio" then offset by 3 cell....

    This worked perfectly!! thank you!

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: If Column A contains "Ohio" then offset by 3 cell....

    You're welcome. Glad to help out and thanks for the feedback. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

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

    Re: If Column A contains "Ohio" then offset by 3 cell....

    Your code works too. You need to change Next Ecell in to cell(Get rid of E)



    Please Login or Register  to view this content.

+ 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] filling cell in column "a" if data present in column "b" issue.
    By timmatthews in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2013, 11:43 AM
  2. [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
  3. Replies: 9
    Last Post: 11-06-2012, 08:59 AM
  4. [SOLVED] If Cell in column = "Y" then with offset (0, 1).value match to sheet range A3:A return ...
    By Spyderz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2012, 02:00 PM
  5. [SOLVED] Delete row if cell in Column N equal "Different" or Column P equals "Blank"
    By Cyberpawz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2012, 08:25 AM

Tags for this Thread

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