Consulting

Results 1 to 3 of 3

Thread: Solved: Converting USD to IDR and Sum itself

  1. #1
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location

    Solved: Converting USD to IDR and Sum itself

    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.

    Appreciate your help as I have to do inserting some row and counting manually every month.

    Many thanks in advance.
    Harto

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor
    Joined
    Sep 2007
    Posts
    265
    Location
    Hi Bob,

    You are a star.

    Thank you for all support and assistance.
    Best,
    Harto

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •