PDA

View Full Version : Solved: Converting USD to IDR and Sum itself



slamet Harto
09-04-2008, 01:49 AM
Hi Guys,

Please help me on the following case.

I want to convert all USD value to IDR using rate USD 1 = IDR 10.000
For example : If a cell in column F containing an ?USD? Then it will converting to IDR and Summarize itself.
I?ve trying to solve this case by recording a macro but give me a stuck.
:banghead:
Appreciate your help as I have to do inserting some row and counting manually every month.

Many thanks in advance.
Harto

Bob Phillips
09-04-2008, 02:49 AM
Public Sub ProcessData()
Dim i As Long, j As Long
Dim LastRow As Long

Application.ScreenUpdating = False

With ActiveSheet

LastRow = .Cells(.Rows.Count, "E").End(xlUp).Row
For i = LastRow To 1 Step -1

If .Cells(i, "F").Value = "USD" Then

For j = 7 To 19 'G to S

.Cells(i, j).Value = .Cells(i, j).Value * 10000
Next j
.Cells(i, "F").Value = "IDR"
End If

If i > 1 Then
If .Cells(i, "E").Value = .Cells(i - 1, "E").Value Then

For j = 7 To 19 'G to S

.Cells(i - 1, j).Value = .Cells(i - 1, j).Value + .Cells(i, j).Value
Next j
i = i - 1
.Rows(i + 1).Delete
End If
End If
Next i
End With

Application.ScreenUpdating = True

End Sub

slamet Harto
09-04-2008, 05:32 PM
Hi Bob,

You are a star.

Thank you for all support and assistance.
Best,
Harto