I created this macro to grab data from one sheet and put it in another sheet exactly where I want it.
The macro does not crash, but it doesn't do anything either. can anyone see anything wrong with the code?
VB Code:
Sub Macro1() Dim rngName As Variant Dim sName As String Dim A As Long Dim B As Long Dim C As Long Dim D As Long Dim E As Long Dim F As Long Dim G As Long Dim H As Long Dim rngPerfGrid As Range Dim rngGridCell As Range 'Set the reference to the Result Grid Set rngPerfGrid = ThisWorkbook.Worksheets("Output").Range("C8:L16") 'Start with the first name Set rngName = ThisWorkbook.Worksheets("Input").Range("A3") Do '----------------------------------------------- 'Get the employee name sName = rngName.Value 'Self Rankings A = rngName.Offset(0, 5) B = rngName.Offset(0, 6) C = rngName.Offset(0, 7) D = rngName.Offset(0, 8) E = rngName.Offset(0, 9) F = rngName.Offset(0, 10) G = rngName.Offset(0, 11) H = rngName.Offset(0, 12) 'Set the target cell range in the main grid Set rngGridCell = rngPerfGrid.Cells(0, 1) With rngGridCell If sName = reportName Then rngGridCell.Value = A rngGridCell.Offset(0, 1).Value = B rngGridCell.Offset(0, 2).Value = C rngGridCell.Offset(0, 3).Value = D rngGridCell.Offset(0, 4).Value = E rngGridCell.Offset(0, 5).Value = F rngGridCell.Offset(0, 6).Value = G rngGridCell.Offset(0, 7).Value = H End If End With Set rngName = rngName.Offset(1, 0) Loop Until rngName.Value = "" End Sub




Reply With Quote