• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macro required to pick one cell

Azwad

New Member
Hello Everyone!

Like below table I have 3 source & targets. Their distance range are same. I need to pick only one source cell from this table . So, need a comment "YES" for the picked one and "NO" for the rest by using a macro. Would you please help me on this.

78260
 

Attachments

  • Asked Question.xlsx
    9.2 KB · Views: 8
What is the criteria by which a row is picked?
All these source & targets are close proximate. So, I need to keep one & discard others. The criteria is to pick one source within the same distance range (<.2 KM) from the group.
 
Hello, according to your attachment an Excel basics VBA demonstration for starters :​
Code:
Sub Demo1()
    With [E6].Resize([B5].CurrentRegion.Rows.Count - 1)
        .Value2 = Evaluate("IF(ROW(" & .Address & ")=RANDBETWEEN(" & .Row & "," & .Row + .Rows.Count - 1 & "),""YES"",""NO"")")
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Back
Top