+ Reply to Thread
Results 1 to 3 of 3

How to set an offset value in a range

Hybrid View

  1. #1
    Registered User
    Join Date
    07-24-2012
    Location
    Simi Valley, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    How to set an offset value in a range

    I'm trying to copy data from column B to column AO if column C meets a condition. My problem is I don't know how to set the result value. (non-programmer)

    Sub MoveSubDescToAtt()
    
       For Each Cell In Range("C:C")
          If Cell.Value = "[No Product Description]" Then
           Cell.Offset(0, 38) = "I need this cell to equal the contents of what's in column B, same row) 
    
          End If
        Next
    
    End Sub
    Thank you in advance.

  2. #2
    Registered User
    Join Date
    07-12-2012
    Location
    New Hampshire, United States
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: How to set an offset value in a range

    Is this what you're looking for? Not much different from what you had:

    Sub MoveSubDescToAtt()
    
       For Each Cell In Range("C:C")
          If Cell.Value = "[No Product Description]" Then
           Cell.Offset(0, 38) = Cell.Offset(0, -1).Value
    
          End If
        Next
    
    End Sub

  3. #3
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to set an offset value in a range

    or
    Sub MoveSubDescToAtt()
    Dim r As Range
    For Each r In Intersect(ActiveSheet.UsedRange, Range("C:C"))
        If r.Value = "[No Product Description]" Then r(1, 39) = r.Previous
    Next
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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