Consulting

Results 1 to 4 of 4

Thread: MAcro Help

  1. #1

    MAcro Help

    Hi
    Im trying to create a macro to copy cells K1 to AE1 to every row that has data in column A. Once it finds an empty cell in column A i want the macro to stop

    help please
    Mark

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Hunh?

    what you mean.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    i want to select cells K1 through to AE1 and then copy them down through every row that has data in column A.
    For example if A1 through to A? has data i want to copy the cells in ranke k1:Ae1 through to K?:AE?

    the problem i have is that the data changes and the amount of rows with data in column A can change (increase)

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Sub CopyAndPaste_KAE()
    Dim rngKAE as Range
    Dim r as Long
    
    With Sheets("Sheet1") 'Edit to suit
    Set rngKAE = .Range("K1:AE1")
    
    For r = 2 to .Cells(Rows.Count, "A").End(xlUp).Row
    If .Cells(r, "A") = "" Then .Range("K" & r & ":AE" & r) = rngKAE
    Next r
    End With
    End Sub
    .Cells(r, "A") is the same as .Range("A" & r)
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

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