Results 1 to 14 of 14

Thread: Multiple arguments used in cell function

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    VBAX Mentor
    Joined
    Feb 2015
    Posts
    395
    Location
    This is what you are aiming for I think
    Given the names of the various tables etc, I could not resist naming the macro in this way - LOL
    Basically what the vba does is put each value from column A in the "range" (in turn) into cell A23 and then copies the calculated value each time from T7 and places it in column C of the "range."
    NOTE - this will only work if you have calculation set to automatic. Can add 2 lines to vba (to switch it on and then off again)
    Workbook incl macro attached. (Values left blank in column C)

    Sub Tabulate_Stiffness_By_Degree()
    
    
    Dim lr As Long
    Dim Range01 As Range
    
    
    With Sheets("Sheet1")
    
    
    'determine the lasr row in range to be tabulated
    'assumes there are no empty cells in column A in the range required
        lr = .Range("A41").End(xlDown).Row
    
    
    'sets the range for which values are to be tabulated
        Set Range01 = .Range("A41:A" & lr)
    
    
    'and for each cell in that range
            For Each r In Range01
    'put the value of that cell into cell A23
                Range("A23").Value = r.Value
    'then take the (newly-calculated) value from T7 and copy that to correct row in column C
                Range("C" & r.Row).Value = .Range("T7").Value
    
    
            Next
    End With
    End Sub
    Attached Files Attached Files

Posting Permissions

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