+ Reply to Thread
Results 1 to 4 of 4

Find Cell in a Range that has same Month and Year as Referenced Cell

  1. #1
    Registered User
    Join Date
    09-22-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    2

    Cool Find Cell in a Range that has same Month and Year as Referenced Cell

    I'm attempting to enter monthly income, expense and balance by current month (or month entered in referenced cell "B1" on Sheet2.

    I have more work to do after this part is solved, but it's the biggest hurdle right now.

    I want to look in every cell in a range, and the cell with the same month and year as B1, I want to use the offset function to enter the income, expense and balance below that cell (month). Here's what I have

    Sub NewDash()
    'Enters Dashboard balance per Date in "B1"
    Dim a As Integer
    Dim b As Integer


    a = Month(Sheet2.Cells(1, 2))

    b = Year(Sheet8.Cells(1, 2))

    For Each cell In Range("Spend[[Month]:[Dec-2022]]")
    If Month(cell.Value) = "a" And Year(cell.Value) = "b" Then
    Range("A1").Offset(0, 0).Range("A1").Value = Sheet2.Range("TotalIncome")
    Range("A1").Offset(1, 0).Range("A1").Value = Sheet2.Range("TotalExpense")
    Range("A1").Offset(2, 0).Range("A1").Value = Sheet2.Range("TotalBalance")
    End If
    Next cell
    End Sub

    Any assistance is greatly appreciated

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Find Cell in a Range that has same Month and Year as Referenced Cell

    Try

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-22-2020
    Location
    USA
    MS-Off Ver
    365
    Posts
    2

    Re: Find Cell in a Range that has same Month and Year as Referenced Cell

    That looks like the same exact code. Also I receive a Compile Error: Expected variable or procedure, not module

  4. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Find Cell in a Range that has same Month and Year as Referenced Cell

    We need to see the workbook to troubleshoot further. Follow instructions in the yellow banner above

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Extracting Date (year,month,day) from cell with Date (year,month,day,time)
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2020, 01:58 PM
  2. [SOLVED] Highlight cells containing the same month referenced as text in another cell
    By Perk1961 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-15-2017, 10:34 AM
  3. Replies: 4
    Last Post: 12-10-2013, 06:41 PM
  4. Find a cell based on the worksheet referenced
    By angela.fitt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-13-2013, 07:40 PM
  5. Replies: 4
    Last Post: 07-03-2013, 01:34 AM
  6. [SOLVED] display cell to show only Month/year to do sumif calc if today()= any day of month
    By fireguy7 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2013, 06:55 PM
  7. Replies: 1
    Last Post: 08-13-2012, 11:18 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