Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
How can I have excel go down a list and check for certain conditions?

This is code the internet and I came up with. Please could you tell me what I’m doing wrong? I keep getting an error that says “can’t use a loop without a do”

Sub additions ()

Range(“BI1”)  = “Comments”

Range(“V2”).Select

Do until IsEmpty(ActiveCell)


If (Range(ActiveCell) = “DM”) Then 
ActiveCell.Offset(0,39).Select
Range(ActiveCell) = “Developed Markets”
ActiveCell.Offset(1,-39).Select
End If

Loop

End Sub
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Add String to One Column If Another String in Another Column

Option Explicit

Sub Additions()
    
    Dim ws As Worksheet: Set ws = ActiveSheet ' improve!
    
    Dim srg As Range
    Set srg = ws.Range("V2", ws.Cells(ws.Rows.Count, "V").End(xlUp))
    
    Dim drg As Range: Set drg = srg.EntireRow.Columns("BI")
    ws.Range("BI1").Value = "Comments"
    
    Dim sCell As Range
    Dim r As Long
    
    For Each sCell In srg.Cells
        r = r + 1
        If CStr(sCell.Value) = "DM" Then ' is a match
            drg.Cells(r).Value = "Developed Markets"
        'Else ' is not a match; do nothing
        End If
    Next sCell
 
    MsgBox "Additions finished.", vbInformation
    
End Sub
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!