Consulting

Results 1 to 3 of 3

Thread: Copy data from rows to other worksheets

  1. #1
    VBAX Regular
    Joined
    Dec 2017
    Posts
    17
    Location

    Copy data from rows to other worksheets

    Hi,
    I have asked a similar question before but want to make the macro better so here goes.
    I want to copy a row of data as such: Column D, E, F, H and I (omitting G). The rows are copied down to the last value in column D
    The data must then go into the worksheet that is stated in Column A (tab name has been inserted into column A), these values must be pasted in Row 14A through to 14E in each worksheet.

    Any help would be appreciated
    Thanks

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Option Explicit
    
    
    Sub test()
        Dim i As Long
        
        For i = 1 To Range("D" & Rows.Count).End(xlUp).Row
            With Rows(i)
                .Range("d1:f1,h1:i1").Copy Sheets(.Range("a1").Text).Range("a14")
            End With
        Next
        
    End Sub

    マナ

  3. #3
    VBAX Regular
    Joined
    Dec 2017
    Posts
    17
    Location
    Quote Originally Posted by mana View Post
    Option Explicit
    
    
    Sub test()
        Dim i As Long
        
        For i = 1 To Range("D" & Rows.Count).End(xlUp).Row
            With Rows(i)
                .Range("d1:f1,h1:i1").Copy Sheets(.Range("a1").Text).Range("a14")
            End With
        Next
        
    End Sub

    マナ
    Thanks Mana - as usual it worked perfectly

Posting Permissions

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