Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a worksheet that has 3 columns of data:
Column 1 - Names of People Column 2 - Date (mm/dd/yyyy) Column 3 - Time (hh:mm:ss) Each name in column 1 corresponds to their own worksheet. I am trying to get Column 3 data to copy to the correct worksheet in the correct field after matching the date in Column 2 to the same date in Column A in the persons worksheet. I have about 6 other macros running in this worksheet but cant seem to get this one to work. Below is the code I currently have built: Sub Adherence() Dim r As Range, cell As Range, sh As Worksheet Dim lastrow As Long, c As Range, fDate As Date With Worksheets("Adherence") Set r = .Range(.Range("A1"), .Range("A1").End(xlDown)) End With For Each cell In r For Each sh In Worksheets If LCase(sh.Name) < "adherence" Then If sh.Cells(2, "B").Value = cell Then fDate = cell.Offset(0, 1).Value cell.Offset(0, 2).Copy Set c = sh.Range("A15:A45").Find(fDate, LookIn:=xlValues) sh.Range("X" & c.Row).PasteSpecial xlPasteValues End If End If Next Next End Sub So to recap, I am matching the name in Column A on the 'Adherence' worksheet to the name in B2 on the persons worksheet. If match, then match Column B on the 'Adherence' worksheet with the date in A15:A45 on the persons worksheet, then copy Column C on the 'Adherence' worksheet to Column X on the persons worksheet. Any suggestions or if you can identify where my problem is, please let me know. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with VBA code - Can't figure out what is wrong | Excel Programming | |||
MACRO TO GET BALANCE FIGURE | Excel Programming | |||
Can't figure out why Macro wont work???? | Excel Worksheet Functions | |||
Can you help me figure out why my macro is running slowly? | Excel Programming | |||
Vlookup - can't figure out what's wrong | Excel Worksheet Functions |