Results 1 to 3 of 3

Macro to query column for date if found place text in cell

Threaded View

2k05gt Macro to query column for... 08-30-2012, 08:09 AM
2k05gt Re: Macro to query column for... 09-05-2012, 11:19 AM
2k05gt Re: Macro to query column for... 06-06-2014, 06:06 PM
  1. #1
    Registered User
    Join Date
    01-06-2010
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    54

    Macro to query column for date if found place text in cell

    I am trying to make a macro that will query a column J4 for a date, if the date is found say "Wednesday, July 4, 2012" (J8)
    get the text from Column K8 "Independence Day" and insert the text in Cell (H1).

    The Macro Prints sign in sheets with the date in H2, it only prints Monday through friday.
    then skips the weekend and the next date will start the following Monday.

    The Federal Holiday schedule is in column range J (Date) and K (Holiday)

    This is where I am stuck ....

    EmployeeTimeSheet_2012.xlsm

    Sub Print_Sheets()
    Dim HolidayDate As HDate
    Dim WeekDayDate As WDate
    Dim Holiday As String
    Dim ColumnCount As Integer
    Dim RowCount As Integer
    
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
        Dim LSearchRow As Integer
        Dim LCopyToRow As Integer
        
        LSearchCol = J
        LCopyToRow = 2
        
        While Len(Range("J" & CStr(LSearchCol)).Value) > 0
            
    'If value in column J = Cell H2, copy next Cell and paste to Cell H1
            If Range("J" & CStr(LSearchRow)).Value = H2 Then
             
                Cell(CStr(LSearchCol) & ":" & CStr(LSearchCol)).Select
                Selection.Copy
                Cell(H1).Select
                ActiveSheet.Paste
            
            End If
        Wend   
    For i = 1 To 4
    Range("H2") = Range("H2") + 1
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    Next i
    For n = 1 To 3
    Range("H2") = Range("H2") + 1
    Next n
    End Sub
    The Print Macro works fine, it's the date and holiday peice I am trying to get
    Last edited by 2k05gt; 09-05-2012 at 11:40 AM.

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