Rabu, 23 November 2011

Bedah Tunas Gadget: Change Case

Kali ini saya akan mencoba membedah source code dari salah satu fitur Tunas Gadget yaitu Change Case. Change Case bertujuan untuk merubah huruf besar dan kecil pada sel Excel menjadi HURUF BESAR (UPPERCASE), huruf kecil (lower case), Huruf kalimat (Sentense case) dan Huruf Judul (Title Case). Jika fitur ini mudah didapatkan di Microsoft Word, maka untuk di Microsoft Excel kita bisa menggunakan fitur ini.

Di sini saya menggunakan form sebagai Graphic User Interface (GUI) atau antar muka agar kita bisa lebih mudah menjalankan fungsinya dibanding kita menggunakan function-function yang terpisah. Karena dalam fitur Change Case ini terdapat 8 function sehingga akan lebih mudah jika kita menggunakan form daripada 8 function tersebut.

Kita dapat membuat sebuah file baru yang disimpan sebagai file Excel Add-in atau sebagai file excel biasa. Saran saya kita memilih sebagai file Excel Add-in.

Selanjutnya kita membuat form dengan menekan tombol Alt + F8 (Microsoft Visual Basic) lalu Insert > User Form sehingga muncul seperti gambar berikut:


Dengan menggunakan tombol-tombol di Toolbox, silahkan desain form kosong tersebut seperti form di bawah.


Perhatikan nomor-nomornya. Contoh nomor 1 adalah untuk Form, maka isi propertiesnya sesuai petunjuk gambar di bawah ini. Begitu juga untuk nomor 2 hingga 8, ikuti petunjuk propertiesnya.

1. Form


2. UPPERCASE

3. lower case

4. Sentence case

5. Title Case

6. Textbox

7. Run Macro


8. Exit



Setelah form sudah selesai didesain, selanjutnya kita masuk ke bagian source code/scriptnya. Untuk scriptnya pilih View > Code lalu gunakan script berikut:

1. Form
Private Sub UserForm_Activate()
    cmd_run.SetFocus
End Sub


Private Sub UserForm_QueryClose _
(cancel As Integer, CloseMode As Integer)
    
If CloseMode = vbFormControlMenu Then
    cancel = True
End If


End Sub

2. Tombol Radio UPPER CASE
Private Sub opt_upper_Click()
    Label2.Caption = "Text will be changed as " & vbCrLf & "UPPER CASE."
End Sub

3. Tombol Radio lower case
Private Sub opt_lower_Click()
    Label2.Caption = "Text will be changed as " & vbCrLf & "lower case."
End Sub

4. Tombol Radio Sentence case
Private Sub opt_sentence_Click()
    Label2.Caption = "Text will be changed as " & vbCrLf & "Sentence case."
End Sub

5. Tombol Radio Title Case
Private Sub opt_title_Click()
    Label2.Caption = "Text will be changed as " & vbCrLf & "Title Case."
End Sub


7. Tombol Run Macro
Private Sub cmd_run_Click()


On Error GoTo ErrorHandler:


If opt_upper = False And opt_lower = False And opt_sentence = False And opt_title = False Then
    MsgBox "Please choose a case how text should be changed", vbExclamation + vbOKOnly, "Choose Method"
Else
If opt_upper = True Then
    Dim cell_upper As Range
    For Each cell_upper In Selection.Cells
    If cell_upper.HasFormula = False Then
    cell_upper = UCase(cell_upper)
    End If
    Next
Else
If opt_lower = True Then
    Dim cell_lower As Range
    For Each cell_lower In Selection.Cells
    If cell_lower.HasFormula = False Then
    cell_lower = LCase(cell_lower)
    End If
    Next
Else
If opt_sentence = True Then
    For Each cell In Selection.Cells
    s = cell.Value
    Start = True
    For i = 1 To Len(s)
    ch = Mid(s, i, 1)
          Select Case ch
          Case "."
          Start = True
          Case "?"
          Start = True
          Case "a" To "z"
          If Start Then ch = UCase(ch): Start = False
          Case "A" To "Z"
          If Start Then Start = False Else ch = LCase(ch)
          End Select
    Mid(s, i, 1) = ch
    Next
    cell.Value = s
    Next
Else
If opt_title = True Then
    Dim cell_title As Range
    For Each cell_title In Selection.Cells
    If cell_title.HasFormula = False Then
    cell_title = Application.Proper(cell_title)
    End If
    Next
End If
End If
End If
End If
End If


GoTo WrapUp:


ErrorHandler:


    MsgBox "Error Macro. Please contact doddy_151619@yahoo.com for further enhancement.", vbCritical + vbOKOnly, "Error Macro"
    
WrapUp:


    Application.Interactive = True
    Application.ScreenUpdating = True
    
End Sub

8. Tombol Exit
Private Sub cmd_cancel_Click()
    Unload Me
End Sub

Selanjutnya pilih ThisWorkbook pada window Project – VBA Project dan gunakan script berikut pada window sebelah kanan:


Sub Open_Form_Change_Case()
 With Form_Change_Case
     .Show vbModeless
 End With
End Sub

Untuk menjalankan macro ini silahkan balik ke window Microsoft Excel lalu tekan Alt + F8 lalu pilih Open_Form_Change_Case dan klik Run.

Untuk cara penggunaan macro ini, silahkan buka artikel Tunas Gadget: Change Case.

Selamat mencoba!
Read More
Setelah sekian lama tidak sempat “menengok” blog ini, ternyata jumlah kunjungan blog Formula Excel ini semakin meningkat. Saat saya menulis post ini terdapat sebanyak 16.939 kunjungan dan total halaman yang dilihat (pageviews) sebesar 46.942 sejak 1 Januari 2011 hingga 19 November 2011 yang berarti +/- 1539 kunjungan per bulan. Memang jumlah ini bukan angka yang besar karena hanya terdapat 2,77 halaman per kunjungan, namun bukankah semua harus disyukuri? :)

Di lihat dari grafiknya, kunjungan meningkat mulai bulan September hingga November 2011 ini. Berikut grafiknya.



Sebagian besar kunjungan ke blog Formula Excel melalui Search Engine (83,32%), kunjungan langsung (11,58%) dan link dari website lain (5,11%)



Keyword yang paling sering digunakan untuk menemukan blog ini adalah “formula excel” sebanyak 1.529 kunjungan. Berikut 10 keyword terbanyak:


Secara wilayah, Indonesia adalah negara yang paling banyak mengunjungi blog ini (ya iyalah… :D) sebanyak 15.668 kunjungan. Namun ternyata ada juga negara lain yang mengunjungi blog ini di antaranya Amerika (159 kunjungan), Malaysia (78 kunjungan), dll.


Untuk wilayah Indonesia, kunjungan dari Jakarta paling banyak yaitu 7.076 kunjungan dari total 37 kota. Berikut 10 kota terbanyak kunjungannya.




Belum sempat tambah artikel

Dikarenakan kesibukan saya di kantor baru sejak Juni 2011, tentunya saya harus fokus dulu ke pekerjaan baru saya yang membutuhkan tenaga ekstra. Di samping itu di kantor saya (demi keamanan katanya) banyak website yang diblock termasuk Blogspot ini sehingga saya tidak bisa “leluasa” update/tambah artikel baru.

Untuk itu saya mohon maaf kepada para pengunjung blog ini yang sudah mengirim email ke saya karena banyak email yang belum sempat saya jawab, begitu juga dengan Facebook Friend Request yang belum saya Approve.

Terima kasih telah mengunjungi blog saya ini :)

Read More

Selasa, 22 November 2011

Add Data Labels to Excel Charts


Last time we created a simple stacked column charts in 6 easy steps. Today I am going to teach you how to add data labels to your charts. This is what we are trying to achieve.


Earlier you learned how to create simple stacked column chart. Now to Add Data Labels to the chart follow these simple steps.
Step 1:- Open the chart which you have prepared. Now right click on the chart and click on Add Data Labels.

Now your chart should appear like the image at the bottom.


Step 2:- Again Right Click on the chart and then Click on Format Data Labels. A pop-up window will appear. In the pop-up window choose Label Option and check Value and Series Name check box and also click on the Inside Base radio button.

Now choose Alignment in the Format Data Labels Options, then from the drop down list of Text direction choose Rotate all text 270 degree.



There you go. You just added data labels to your chart and the final result is this.



Read More

Add Data Labels to Excel Charts


Last time we created a simple stacked column charts in 6 easy steps. Today I am going to teach you how to add data labels to your charts. This is what we are trying to achieve.


Earlier you learned how to create simple stacked column chart. Now to Add Data Labels to the chart follow these simple steps.
Step 1:- Open the chart which you have prepared. Now right click on the chart and click on Add Data Labels.

Now your chart should appear like the image at the bottom.


Step 2:- Again Right Click on the chart and then Click on Format Data Labels. A pop-up window will appear. In the pop-up window choose Label Option and check Value and Series Name check box and also click on the Inside Base radio button.

Now choose Alignment in the Format Data Labels Options, then from the drop down list of Text direction choose Rotate all text 270 degree.



There you go. You just added data labels to your chart and the final result is this.



Read More

Senin, 21 November 2011

Create a Simple Chart in Excel


Today we are going to create a simple Column chart in excel showing sales per year.

Follow these simple steps to create a simple chart in excel. I am using excel 2007 for this example.
Step 1:- Create a simple table in excel as shown in the figure below.


Step 2:- First of all click on an empty cell, then go to Insert > Charts > Column and then click on Stacked Column.


Step 3:- An empty Chart Area will be created. Right click on the Chart Area and then click on Select Data.


Step 4:- Select Data Source dialog box will open. Now click on the Add button as in the image below.


Another pop up dialog box will appear. In the Series name text box select the title sales and in the Series values box click on the first data under sales and then click and drag it up to the last entry of the table.
OR
Click on the first number under Sales hold Shift and then click on the last data.

And then click OK. 


Step 5:- Now the earlier pop up window will reappear but a Series named Sales will appear on the Left hand side. Now click on the Edit button on the right hand side of the window.

One more window will appear. This time select all the years under the title Years and click OK.


Step 6:- Now again click OK on the pop-up window and the final chart will look like this.


Read More

Create a Simple Chart in Excel


Today we are going to create a simple Column chart in excel showing sales per year.

Follow these simple steps to create a simple chart in excel. I am using excel 2007 for this example.
Step 1:- Create a simple table in excel as shown in the figure below.


Step 2:- First of all click on an empty cell, then go to Insert > Charts > Column and then click on Stacked Column.


Step 3:- An empty Chart Area will be created. Right click on the Chart Area and then click on Select Data.


Step 4:- Select Data Source dialog box will open. Now click on the Add button as in the image below.


Another pop up dialog box will appear. In the Series name text box select the title sales and in the Series values box click on the first data under sales and then click and drag it up to the last entry of the table.
OR
Click on the first number under Sales hold Shift and then click on the last data.

And then click OK. 


Step 5:- Now the earlier pop up window will reappear but a Series named Sales will appear on the Left hand side. Now click on the Edit button on the right hand side of the window.

One more window will appear. This time select all the years under the title Years and click OK.


Step 6:- Now again click OK on the pop-up window and the final chart will look like this.


Read More

Rabu, 16 November 2011

Cara Menggunakan Fungsi Lookup & Referensi

Fungsi Lookup & Reference digunakan untuk mengambil atau membaca informasi dari tabel lain untuk dijadikan referensi ke dalam tabel yang sedang dianalisis. Fungsi Excel yang terdapat pada kategori Lookup & Reference ini salah satunya adalah Hlookup dan Vlookup.


Kedua fungsi tersebut pada dasarnya adalah sama, namun digunakan pada orientasi yang berbeda saja. Hlookup digunakan untuk mengambil atau membaca informasi dari tabel lain yang disusun secara horizontal. Sedangkan Vlookup digunakan untuk mengambil atau membaca informasi dari tabel lain yang disusun secara vertikal.


Berikut ini diberikan contoh penggunaan fungsi Vlookup untuk menentukan huruf dan beasiswa yang didapatkan dari hasil nilai mata pelajaran yang diujikan. Dengan ketentuan seperti pada tabel berikut ini.

Nilai

Huruf

Beasiswa

Kurang dari 5

E

Tidak dapat

Antara 6 – 7

D

Tidak dapat

Antara 7 – 8

C

Tidak dapat

Antara 8 – 8.5

B

25% SPP

Lebih besar dari 8.5

A

50% SPP


Oleh karena contoh berikut ini adalah Vlookup maka penyusunan tabel juga harus disusun secara vertikal seperti yang terlihat pada gambar di berikut ini. Pada gambar tersebut diperlihatkan tabel yang akan dianalisis berada di atas dari tabel yang dipakai untuk referensi/pengambilan informasi.

Penyusunan tabel Vlookup


Bentuk dari fungsi Vlookup adalah:


Vlookup(lookup_value,table_array,col_index_num,range_lookup)


· Lookup_value, nilai yang dipakai sebagai dasar awal melakukan referensi pada tabel yang sedang dianalisis.

· Table_array, rangkaian sel pada tabel informasi (tabel yang dipakai untuk mencari informasi).

· Col_index_num, posisi (nomor) kolom yang dipakai untuk pencarian informasi.

· Range_lookup, berupa nilai logika berisi True atau False. Jika bernilai True (tidak perlu disebutkan nilainya), maka tabel informasi harus diurutkan secara ascending.


Selanjutnya anda dapat menuliskan formula pada sel K8 sebagai berikut:

=VLOOKUP(J8,$D$21:$F$25,2)


J8 adalah nama sel nilai lookup, $D$21:$F$25 adalah range (rangkaian sel) tabel informasi dan 2 adalah posisi (nomor) kolom pada tabel informasi (kolom Huruf).


Sedangkan pada sel L8 formulanya adalah sebagai berikut:

=VLOOKUP(J8,$D$21:$F$25,3)


Pada formula sel L8 ini yang berbeda adalah posisi (nomor) kolom yang yang dipakai untuk referensi yaitu kolom 3 dari tabel informasi (kolom Beasiswa).


Setelah anda lakukan Autofill maka hasil akhirnya akan seperti pada gambar berikut.

Hasil penggunaan Vlookup

Read More
Backlinks to my website? ping fast  my blog, website, or RSS feed for Free Tips dan Trik Sukses Bisnis OnlineindotradingUAW BMKGNTTfree indotradingcms | indotradingsakpa
Search Engine
www.e-referrer.com