Results 1 to 10 of 10

How to fill an array with values in column C based on Column D date value of Today

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-15-2012
    Location
    California, USA
    MS-Off Ver
    Microsoft 365 Subscription
    Posts
    120

    How to fill an array with values in column C based on Column D date value of Today

    I am trying to search through Column D to find all dates = to today, then take the values in Column C and place them into a column in another workbook. I was attempting to do this in the same worksheet as a test but am having difficulty. I have some code I am working with but having trouble getting it to do what I need it to do. Workbook is attached as well

    Sub FillShippingReport()
    
    Dim cel As Range
    Dim ws As Worksheet
    Dim l As Long
    Dim lRow As Long
    Dim i As Integer
    Dim lTarget As Long
    Dim aryInfo(2) As String 'Not sure how to set this, Only going to store 1 Value for each Date found
    
    Application.ScreenUpdating = False
    
    Set ws = ThisWorkbook.Sheets("2015 Log")   'set the ws variable to the current Packing List Log sheet
    lRow = ws.Range("D" & Rows.Count).End(xlUp).Row   'find the last row in Packing List Log
    
                For Each cel In ws.Range("D3:D300") 'loop through all ship dates,
                'would like this to only run from D3 to lRow
                    If cel.Value = (Date) Then  'if the ship date is today
                        For l = cel.Offset(-1).Row To lRow  'loop through each cell next to todays ship dates Column C
                            For i = 1 To 1
                                aryInfo(i) = Cells(l, i).Value   'save all the Packing List Numbers
                            Next i
    
                                With Sheets("Shipping Report")     'go to sheet with shipping report
                                    lTarget = .Range("C" & Rows.Count).End(xlUp).Offset(1).Row
                                        For i = 1 To 1
                                            .Cells(lTarget, i).Value = aryInfo(i)   'copy Packing List Numbers
                                        Next i
                                End With
                        Next l
                    End If
                Next cel
            
    Application.ScreenUpdating = True
    
    End Sub
    Last edited by jrtraylor; 01-10-2016 at 01:02 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. storing multiple value in a single cell (through arrays or without arrays)?
    By mak51061 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-25-2014, 09:27 PM
  2. Declaring multiple multi-dimensional arrays (jagged arrays) - compile error?
    By dfribush in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2013, 05:06 PM
  3. vba compare arrays and remove exact matching arrays
    By jacojvv in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-25-2013, 07:30 AM
  4. [SOLVED] New to arrays-where do I find a good beginners guide to multi dimensional arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2013, 07:44 PM
  5. Sum columns within arrays and then multiplying arrays [?]
    By slickpusher in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-08-2012, 08:50 PM
  6. Help With Arrays, real Basic Arrays
    By Markva in forum Excel General
    Replies: 3
    Last Post: 08-20-2008, 04:11 PM
  7. Arrays - declaration, adding values to arrays and calculation
    By Maxi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2006, 11:15 AM

Tags for this Thread

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