So I have a main sheet that contains a date column (D). Date is as 01/01/2010
.
I want to be able to pull month name and year in a VBA subroutine to sheet1 based on other user input. Here is some of the code I'm trying to make work, this is in a sub in mainsheet:
Dim ws2 As Worksheet
Set ws2 = ThisWorkbook.Sheets("mainsheet")
With ws2
'=YEAR(mainsheet!D2)
' mn = Text([Date], "mmmm")
my= .Cells(Year(1, 3))
End With
After I get the correct month and year (January 2010) I plan to put that in a variable that goes into E1 on sheet1.
I've moved things around, I've used quotes, I've tried range ... it's just not working.