need to modify all selected cells at once


Posted by Erick on July 02, 2001 12:53 PM

Is there a way to modify all selected cells at once.

I have a list of part number in different cells, and I need to add a prefix to all of them. Can I select the ones that need a prefix and while adding the prefix to take effect in all other cells.

Thanks.


From Miami



Posted by Damon Ostrander on July 02, 2001 6:45 PM

Hi Miami,

Here is a simple macro that lets you add a prefix you enter once to all the selected cells.

Happy Computing.

Damon

Sub AddPrefix()

' This macro prefixes text input once by the user
' to all the selected cells.

Prefix = InputBox("Enter prefix to apply to selected cells", _
"Add Prefix Utility")

If Prefix = "" Then Exit Sub

For Each cell In Selection
cell.Value = Prefix & cell.Value
Next cell

End Sub