+ Reply to Thread
Results 1 to 3 of 3

Macro assistance to identify dates in one range and place text in a cell in worksheets

Hybrid View

lilsnoop Macro assistance to identify... 02-08-2013, 11:21 AM
antoka05 Re: Macro assistance to... 02-08-2013, 12:07 PM
lilsnoop Re: Macro assistance to... 02-08-2013, 12:29 PM
  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Macro assistance to identify dates in one range and place text in a cell in worksheets

    Hello,

    I am looking for assistance to do the following:
    I need a macro that would look at date in column A of worksheet titled Sheet1 and then find the same date in the appropriately titled (by month) worksheet tab in row 1 and put an H in row 2 immediately below the identified date. So as an example using the date "1/1/2013" from Sheet1, the macro would identify this date and look at worksheet titled "January" and then locate the date 01/01/13 in cell C1. It would then place a capitalized "H" centered in cell C2. The macro would do this for all dates on sheet1 in column A for the appropriate monthly worksheets.
    I've attached a workbook sample of what I'm trying to accomplish. Thanks for your time and assistance if possible!
    Attached Files Attached Files
    Last edited by lilsnoop; 02-08-2013 at 12:30 PM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Macro assistance to identify dates in one range and place text in a cell in worksheets

    You could use this macro:
    Sub Macro1()
       Dim r As Long, lastRow As Long
       Dim myMonth As String, found As Range
       Dim mySh As Worksheet, destSh As Worksheet
       
       Set mySh = ThisWorkbook.Sheets("sheet1")
       lastRow = mySh.Cells(Rows.Count, 1).End(xlUp).Row
       For r = 2 To lastRow
          myMonth = MonthName(Month(mySh.Cells(r, 1)))
          Set destSh = ThisWorkbook.Sheets(myMonth)
          Set found = destSh.Range("1:1").Find(mySh.Cells(r, 1))
          If Not found Is Nothing Then
             found.Offset(1) = "H"
          End If
          Set destSh = Nothing
       Next r
       Set mySh = Nothing
    End Sub
    Regards,
    Antonio

  3. #3
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2021
    Posts
    974

    Re: Macro assistance to identify dates in one range and place text in a cell in worksheets

    Works Great! Thanks!

+ Reply to 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