ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   prefixing a cell? (https://www.excelbanter.com/excel-programming/375515-prefixing-cell.html)

HockeyFan

prefixing a cell?
 
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?


Bob Phillips

prefixing a cell?
 
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)

"HockeyFan" wrote in message
ups.com...
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?





All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com