djtaverner
04-13-2006, 11:55 AM
Hi
Column 8 in my worksheet has names.
I want the name to change to Bob when the cell in column 4 has OU-BW in it AND the cell in column 8 has content ie, a name in it
As coded below
Sub MacroReplaceName()
'
' MacroChangeToOU Macro
' Macro recorded 13/04/2006 by Registered User
'
Dim Count
Count = 1
ThisWorkbook.Worksheets("reporting").Select
Do While Count < Range("H65536").End(xlUp).Row ' finds last row
If Cells(Count, 4).Value = "OU-BW" And Cells(Count, 8).Value <> "" Then
Cells(Count, 8).Value = "Bob"
Else
Count = Count + 1
End If
Loop
End Sub
A cell near the top of the sheet I can see is replaced properly but the Excel program crashes.
Any suggestions??
Column 8 in my worksheet has names.
I want the name to change to Bob when the cell in column 4 has OU-BW in it AND the cell in column 8 has content ie, a name in it
As coded below
Sub MacroReplaceName()
'
' MacroChangeToOU Macro
' Macro recorded 13/04/2006 by Registered User
'
Dim Count
Count = 1
ThisWorkbook.Worksheets("reporting").Select
Do While Count < Range("H65536").End(xlUp).Row ' finds last row
If Cells(Count, 4).Value = "OU-BW" And Cells(Count, 8).Value <> "" Then
Cells(Count, 8).Value = "Bob"
Else
Count = Count + 1
End If
Loop
End Sub
A cell near the top of the sheet I can see is replaced properly but the Excel program crashes.
Any suggestions??