Hi Friends,
I need to look for a match between Column A of 'DRAM' worksheet and Column A of 'Refer' worksheet and if a match is found then the row containing the match should be stored in a variable 'Cell1' and then my code must look for a string 'WS Group Totals:" in Column B of 'DRAM' sheet and the row containing the string must be stored in a variable Cell2. In the row containing Cell2 the values from Column D till the row end must be multiplied by 10080 and the result must be placed two rows below the last populated row in their respective columns. Once that is done my code must look for the next match of Column A in 'DRAM' and COLUMN A in 'Refer' worksheets and must do the calculation as the same as above. I have written the below code for the purpose but I am repeatedly getting Application or Object defined error...can someone please help me figure out the error...thank you very much..I have attached the original Workbook for your reference...
Option Explicit
Sub DRSummary()
Dim PartRngWorkbook1DRAMSheeta As Range, PartRngWorkbook1DRAMSheetb As Range
Dim cs As Variant, Cell1 As Long, Cell2 As Long, rngMultiply As Range, Cell4 As Long, Cell5 As Long
Dim Cell6 As Long, PartRngWorkbook1Reference1 As Range, a As Variant, wsActive As Worksheet, intCols As Integer, rngValue As Range
Const intMultiplier As Integer = 10080
Dim ab As Worksheet, lastRow As Long
Set PartRngWorkbook1DRAMSheeta = Worksheets("DRAM").Range("A3", Worksheets("DRAM").Range("A65536").End(xlUp))
Set PartRngWorkbook1DRAMSheetb = Worksheets("DRAM").Range("B", Worksheets("DRAM").Range("B65536").End(xlUp))
Set PartRngWorkbook1Reference1 = Worksheets("Refer").Range("A", Worksheets("Refer").Range("A65536").End(xlUp))
Set ab = Worksheets("DRAM")
For Each cs In PartRngWorkbook1DRAMSheeta
If IsNumeric(Application.Match(cs.Value, PartRngWorkbook1Reference1, 0)) Then
Cell1 = PartRngWorkbook1DRAMSheeta.Find(cs.Value).Row
Cell2 = PartRngWorkbook1DRAMSheetb.Find("WS Group Totals:", Range("B", Cell1)).Row
With ab
intCols = .Cells(Cell2, .Columns.Count).End(xlToLeft).Column
lastRow = .Rows(.Rows.Count).Row
Set rngMultiply = .Range(.Cells(Cell2, 4), .Cells(Cell2, intCols))
For Each rngValue In rngMultiply
.Cells(.Rows.Count, rngValue.Column).End(xlUp).Offset(2, 0).Value = intMultiplier * rngValue.Value
Next
End With
End If
Next cs
End Sub
Bookmarks