Tecnologia, programação e muito Visual FoxPro.

segunda-feira, 31 de agosto de 2009

Re: ]] XL-mania [[ sederhanakan select case

 

Om om om .....

karena hasil CASE nya semua sama karakternya, maka dibikin fungsi yang bisa dipanggil aja oom......
' FUNGSI
Public Function berwarna(vString) As String
With vString
    .Interior.Color = RGB(0, 0, 255)
    .Font.Color = RGB(255, 255, 255)
    .Font.Bold = True
End With
End Function

sehingga casenya
' EXAMPLE

Case "TN-A"
   Call berwarna(c) ' --- > MEMANGGIL FUNGSI dengan identifikasi variabel nilai c
Case "TN-B"
    Call berwarna(c)
Case "TN-D"
    Call berwarna(c)
Case "TN-E"
    Call berwarna(c)

Filenya terlampir oomm...



Thanks
Puthut Wibowo
Pengguna VB6 bukan EXCEL



--- On Sat, 8/29/09, Sandy Warsito <mank_ujank@yahoo.com> wrote:

From: Sandy Warsito <mank_ujank@yahoo.com>
Subject: ]] XL-mania [[ sederhanakan select case
To: XL-mania@yahoogroups.com
Date: Saturday, August 29, 2009, 8:07 AM

 

Dear Suhu-suhu Excel yang budiman,
 
Saya telah menulis code seperti di bawah dan sudah bekerja dengan baik, namun dengan listing seperti ini sepertinya akan kesulitan jika suatu saat nanti perlu mengedit case-case nya. Please help untuk menyederhanakannya sehingga mengedit case akan lebih mudah.
 
Makasih.
 
'=========== ========= ========= ========= ========= =======
 
Sub Mark_South()
For Each c In Range("D10:D300" ).Cells
Select Case Left(c.Value, 4)
Case "TN-A"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-B"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-D"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-E"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-F"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
End With
Case "TN-G"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-H"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-J"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-R"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-S"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-T"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-T"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
Case "TN-X"
    With c
        .Interior.Color = RGB(0, 0, 255)
        .Font.Color = RGB(255, 255, 255)
        .Font.Bold = True
    End With
End Select
Next c
End Sub
'=========== ========= ========= ========= ========= =======


__._,_.___
+-:: XL-mania ::::::::::::::::::::----------------------------------+
| Selamat menjalankan ibadah puasa...                               |
| http://www.facebook.com/group.php?gid=37671048001&ref=mf          |
+-------------------------------------------------------------------+
| DILARANG : MLM, money game, OOT, iklan tanpa izin, SARA, testing, |
| pembicaraan pribadi, one line message,  melecehkan,  tidak sopan. |
+-------------------------------------------------------------------+
| Buat subjek yang kreatif, jangan : "tanya", "help", "mohon bantu" |
| Usahakan besar attachment < 200 kb. Gunakan  winzip  jika  perlu. |
+-------------------------------------------------------------------+
| Ajak teman-teman Anda bergabung dengan mengirim e-mail kosong ke  |
| XL-mania-subscribe@yahoogroups.com atau kirimkan mereka file dari |
| http://groups.yahoo.com/group/XL-mania/files/Promotion/           |
+-------------------------------------------------------------------+
| Berikan testimoni di : http://www.friendster.com/xlmania atau...  |
| http://www.xl-mania.com/2008/06/testimoni-xl-mania.html           |
+-------------------------------------------------------------------+
| Message lama ada di :                                             |
| http://groups.yahoo.com/group/XL-mania/messages [perlu yahoo id]  |
| http://www.mail-archive.com/xl-mania@yahoogroups.com              |
+-------------------------------------------------------------------+
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Groups

Do More For Cats Group

Connect and share with

cat owners like you

Get in Shape

on Yahoo! Groups

Find a buddy

and lose weight.

.

__,_._,___

Nenhum comentário:

Arquivo do blog