+ Reply to Thread
Results 1 to 5 of 5

value in offest cell to match

  1. #1
    Registered User
    Join Date
    03-27-2005
    Posts
    59

    value in offest cell to match

    hi does anybody know of any code that will check the value in range b17, match it to an cell in the array b3:p3 and then in the cell diectly under the matching cell place the value 1

    any help would be much appreciated thanks

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: value in offest cell to match

    Hi short_n_curly,
    try...
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: value in offest cell to match

    Or like this perhaps

    Option Explicit

    Sub testval()
    '
    Dim cell As Range

    For Each cell In Range("B3:P3")

    If cell.Value = Range("B17").Value Then
    cell.Offset(1, 0).Value = 1
    End If
    Next cell

    End Sub

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: value in offest cell to match

    Or don't use code. just put formulas into range b4:p4
    Please Login or Register  to view this content.
    and copy it into c4:p4
    Then you don't have to run the macro again, when $B$17 changes, Excel will do it for you.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  5. #5
    Registered User
    Join Date
    03-27-2005
    Posts
    59

    Re: value in offest cell to match

    thanks the vba codes are both great and do what i want, as for the formula, its not an option as i will be clearing the cells often hence the need for vba, thanks anyway

+ Reply to Thread

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