是不是要這個
Sub?dh()Dim?i?As?Integer,?r?As?Integer
r?=?Range("b65536").End(xlUp).Row
For?i?=?3?To?r
With?Cells(i,?2)
If?.Text?=?"經理室"?Then?Cells(i,?3)?=?1001
If?.Text?=?"生產車間"?Then?Cells(i,?3)?=?1002
If?.Text?=?"銷售車間"?Then?Cells(i,?3)?=?1003
If?.Text?=?"保衛科"?Then?Cells(i,?3)?=?1004
End?With
Next
End?SubSub?dd()
Dim?c?As?Range
For?Each?c?In?Range("b3:b"?&?Range("b65536").End(xlUp).Row)
Select?Case?c
Case?"經理室"
Cells(c.Row,?3)?=?1001Case?"生產車間"
Cells(c.Row,?3)?=?1002Case?"銷售車間"
Cells(c.Row,?3)?=?1003Case?"保衛科"
Cells(c.Row,?3)?=?1004End?Select
Next
End?Sub