Results 1 to 2 of 2

Thread: Macro runs..but produces no data

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    74

    Macro runs..but produces no data

    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:
    1. Sub Macro1()
    2. Dim rngName As Variant
    3. Dim sName As String
    4.  
    5. Dim A As Long
    6. Dim B As Long
    7. Dim C As Long
    8. Dim D As Long
    9. Dim E As Long
    10. Dim F As Long
    11. Dim G As Long
    12. Dim H As Long
    13.  
    14. Dim rngPerfGrid As Range
    15. Dim rngGridCell As Range
    16.  
    17.    
    18.     'Set the reference to the Result Grid
    19.     Set rngPerfGrid = ThisWorkbook.Worksheets("Output").Range("C8:L16")
    20.    
    21.     'Start with the first name
    22.     Set rngName = ThisWorkbook.Worksheets("Input").Range("A3")
    23.    
    24.     Do
    25.  
    26.         '-----------------------------------------------
    27.        
    28.         'Get the employee name
    29.         sName = rngName.Value
    30.         'Self Rankings
    31.         A = rngName.Offset(0, 5)
    32.         B = rngName.Offset(0, 6)
    33.         C = rngName.Offset(0, 7)
    34.         D = rngName.Offset(0, 8)
    35.         E = rngName.Offset(0, 9)
    36.         F = rngName.Offset(0, 10)
    37.         G = rngName.Offset(0, 11)
    38.         H = rngName.Offset(0, 12)
    39.  
    40.         'Set the target cell range in the main grid
    41.         Set rngGridCell = rngPerfGrid.Cells(0, 1)
    42.        
    43.         With rngGridCell
    44.            
    45.             If sName = reportName Then
    46.            
    47.             rngGridCell.Value = A
    48.             rngGridCell.Offset(0, 1).Value = B
    49.             rngGridCell.Offset(0, 2).Value = C
    50.             rngGridCell.Offset(0, 3).Value = D
    51.             rngGridCell.Offset(0, 4).Value = E
    52.             rngGridCell.Offset(0, 5).Value = F
    53.             rngGridCell.Offset(0, 6).Value = G
    54.             rngGridCell.Offset(0, 7).Value = H
    55.                      
    56.             End If
    57.                        
    58.         End With
    59.  
    60.         Set rngName = rngName.Offset(1, 0)
    61.    
    62.         Loop Until rngName.Value = ""
    63.    
    64. End Sub

  2. #2
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Macro runs..but produces no data

    '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)
    append ".Value" to these variables???
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

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



Click Here to Expand Forum to Full Width