Results 1 to 4 of 4

Copy column data on one sheet to row or column date on another sheet based on user in

Threaded View

  1. #1
    Registered User
    Join Date
    01-11-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Copy column data on one sheet to row or column date on another sheet based on user in

    I would like to copy data on a Master sheet to a Weekly sheet to retain the values for each week.
    I have this code, but it doesn't find the date for some reason:

    Public Sub copycolumns()
    
      Dim rng As Range
      Dim WEDate As String
      Dim Monthws As String
      Dim Weekws As String
      
      Monthws = "Master Monthly-Weekly Totals"
      Weekws = "Weekly"
      WEDate = Worksheets(Monthws).Range("B4").Value 'Get Week ending Date
      
      If WEDate = "1/8/2012" Then
        MsgBox "The Dates Match"
      Else
        MsgBox "The Dates Don't Match"
      End If
      
      With Worksheets(Monthws)
        'WEDate = Worksheets(Monthws).Range("B4").Value 'Get Week ending Date
        Set rng = Worksheets(Monthws).Range("D1:D128").Find("Weekly Running Total", LookIn:=xlValues)
        rng.Offset(2, 0).Resize(rng.End(xlDown).Rows + 3).Copy
        Application.CutCopyMode = False
     
      With Worksheets(Weekws)
        Set rng = .Range("A1:A53").Find(What:=WEDate, LookIn:=xlValues)
        
        If Not rng Is Nothing Then
           ActiveSheet.Cells(1, 0).PasteSpecial Paste:=xlPasteValues
           rng.Offset(1, 0).Resize(rng.End(xlDown).Row - 1).PasteSpecial (xlPasteAll)
        End If
     End With
    End With
    1) Read Date input (End of the week date) by User in B4 on the Master Monthly-Weekly Totals sheet
    2) Copy Data in Column D
    3) Go to Worksheet "Weekly" and find the same date input by the user, and paste the data to that column

    I think the problem here is the Find(What:=WEDate), I've tried Find(WEDate), even tried Find(CDate(WEDate)), Excel always finds Nothing, so my paste code never executes.
    Attached Files Attached Files

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