K
K
Hi all, Can any body please help me with the macro below
Sub MultAmt()
Const x = 12
Dim i As Integer
Dim LRow As Long
Dim rng As Range, c As Range
Dim rng2 As Range, c2 As Range
LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Sheet2.Range("D2" & LRow)
LRow = Sheet3.Cells(Rows.Count, "A").End(xlUp).Row
If LRow = 1 Then
'do nothing
Else
Sheet3.Rows("2:" & LRow).Delete
End If
i = 1
For Each c In rng
LRow = Sheet3.Cells(Rows.Count, "A").End(xlUp).Row
c.EntireRow.Copy Sheet3.Range("A" & LRow + i & ":A" & LRow +
x)
Next
LRow = Sheet3.Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Sheet3.Range("D2" & LRow)
LRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Set rng2 = Sheet1.Range("A3:M" & LRow)
i = 2
For Each c In rng
c.Offset(, 1).Value = c.Offset(, 1).Value * _
(Application.WorksheetFunction.VLookup(c.Value, rng2, i) /
100)
If i = 13 Then
i = 2
Else
i = i + 1
End If
Next
Sheet3.Columns("E:E").NumberFormat = "0"
End Sub
This macro is already on my sheet which i have uploaded (see the link
below to look at the sheet)
http://www.savefile.com/files/1530076
Please give a look to my sheet as i have explained what i need on the
sheet. i think what i required need some amendment in macro which i
cant figure out how to do. If any friend can do that for me it will
very helpful. Many thanks
Sub MultAmt()
Const x = 12
Dim i As Integer
Dim LRow As Long
Dim rng As Range, c As Range
Dim rng2 As Range, c2 As Range
LRow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Sheet2.Range("D2" & LRow)
LRow = Sheet3.Cells(Rows.Count, "A").End(xlUp).Row
If LRow = 1 Then
'do nothing
Else
Sheet3.Rows("2:" & LRow).Delete
End If
i = 1
For Each c In rng
LRow = Sheet3.Cells(Rows.Count, "A").End(xlUp).Row
c.EntireRow.Copy Sheet3.Range("A" & LRow + i & ":A" & LRow +
x)
Next
LRow = Sheet3.Cells(Rows.Count, "A").End(xlUp).Row
Set rng = Sheet3.Range("D2" & LRow)
LRow = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
Set rng2 = Sheet1.Range("A3:M" & LRow)
i = 2
For Each c In rng
c.Offset(, 1).Value = c.Offset(, 1).Value * _
(Application.WorksheetFunction.VLookup(c.Value, rng2, i) /
100)
If i = 13 Then
i = 2
Else
i = i + 1
End If
Next
Sheet3.Columns("E:E").NumberFormat = "0"
End Sub
This macro is already on my sheet which i have uploaded (see the link
below to look at the sheet)
http://www.savefile.com/files/1530076
Please give a look to my sheet as i have explained what i need on the
sheet. i think what i required need some amendment in macro which i
cant figure out how to do. If any friend can do that for me it will
very helpful. Many thanks