prefixing a cell?

  • Thread starter Thread starter HockeyFan
  • Start date Start date
H

HockeyFan

I have a simple question.
I have a column in a spreadsheet where some rows start with the letter
Q, and some do not. I'd like to update the rows so that column is
prefixed with the letter Q on every row.
Is there a way to do this?
 
Sub AddQ()
Dim i As Long

For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
If Cells(i,"A").Value <> "" Then
If Left(Cells(i,"A").Value,1) <> "Q" Then
Cells(i,"A").value = "Q" & Cells(i,"A").value
End If
End If
Next i
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top