Closed Thread
Results 1 to 3 of 3

copy dynamic range to another sheet

  1. #1
    Registered User
    Join Date
    01-26-2007
    Posts
    21

    copy dynamic range to another sheet

    I make this code:
    Sub macro4()
    Dim mymonth As String
    mymonth = Application.Worksheets("drivers").Range("b1")
    Application.ScreenUpdating = False
    Select Case mymonth
    Case "1"
    Sheets("drivers").Select
    Range("d5:d36").Copy
    Sheets("overtime").Select
    Range("v2:v36").Select
    Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Case "2"
    Sheets("drivers").Select
    Range("d5:d36").Copy
    Sheets("overtime").Select
    Range("w2:w36").Select
    Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
    Application.CutCopyMode = False
    End Select
    End Sub
    In this code I must condition who will compare range of employees in the sheets "overtime"(column P2:P40) and range of employees in the sheets "drivers"(column A2:a36).Afterwards when I run code value of working hours will be put in adequate cells.
    E.C. if employee "John" is in second row in the sheets "driver" and in fourth
    row in the sheets "overtime" value of working hours must be in fourth row

  2. #2
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: copy dynamic range to another sheet

    if employee "John" is in second row in the sheets "driver" and in fourth
    row in the sheets "overtime" value of working hours must be in fourth row
    value of working hours will be put in adequate cells
    A sample workbook would be extremely helpful.

    Also, please wrap your code with the
    Please Login or Register  to view this content.
    button, it's the one that looks like a number sign. This is a forum rule.
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: copy dynamic range to another sheet

    Thanks mewingkitty,

    barkarlo, Please read the below and then edit you're post to include code tags

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Many thanks

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1