Sometime we want make format for number, such if < 100 then is red, we
can make with help VBA Excel:
1. Open Excel and Finished the data
2. Click Developer | Visual Basic /ALT + F11.
3. Click Insert | Module.
4. Type this code,
- Sub Nameprosedur() and press Enter, example : sub Warnai()
- Dim Cell As Range (declare cell to Range)
- Use For Each for loop : For Each Cell In Selection
- Use If Elseif :
If Cell.Value < 100 Then
Cell.Font.Color = vbRed
ElseIf Cell.Value >= 100 And Cell.Value <= 499 Then ‘gunakan and untuk
dua syarat
Cell.Font.Color = vbBlack
Else
Cell.Font.Color = vbBlue
End if
- and type for close the for : Next Cell
5. Go Back to Excel and Click Develepor | Macro
6. Click Name Macro, click Option
7. Make Description and Shorcut key
8. For test Highlight cell and use Shortcut key-nya and save as Excel
Macro-Enaled(xlxm) or Add -in.
Sunday, February 14, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment