Hello
I was wondering if anyone could help me as I am stuck with a problem at work. Basically I have customer names and addresses in an excel 2007 spreadsheet, and I want to move all the "Mr" and "Mrs" etc. up three rows as it they are in the wrong place. There are tons of these to do so I was trying to use VBA but am awful at programming. Here it is what I have now:
Private Sub Workbook_Open()
Worksheets("Sheet1").Cells
Dim Mr As String
Dim Mrs As String
Dim Miss As String
Dim Ms As String
strCellValue = (cell.Value)
Mr = "MR"
Mrs = "MRS"
Miss = "MISS"
Ms = "MS"
If strCellValue = Mr Then
ActiveCell.Offset(-3, 0).Activate
ElseIf strCellValue = Mrs Then
ActiveCell.Offset(-3, 0).Activate
ElseIf strCellValue = Miss Then
ActiveCell.Offset(-3, 0).Activate
ElseIf strCellValue = Ms Then
ActiveCell.Offset(-3, 0).Activate
End If
End Sub
Could someone show me what I've done wrong? It's obviously mish-mashed code I've formed whilst attempting to learn how to do this through the internet. I would be so grateful if anyone can help!
Bookmarks