LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Help With Macro - Cannot figure out what I am doing wrong

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with VBA code - Can't figure out what is wrong excel-ant Excel Programming 1 April 26th 08 12:34 AM
MACRO TO GET BALANCE FIGURE K[_2_] Excel Programming 0 December 27th 07 04:40 PM
Can't figure out why Macro wont work???? Krefty Excel Worksheet Functions 0 November 2nd 07 12:06 AM
Can you help me figure out why my macro is running slowly? Phil Excel Programming 5 June 12th 07 11:54 PM
Vlookup - can't figure out what's wrong pm Excel Worksheet Functions 5 December 15th 06 08:02 PM


All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"