After much time spent thinking about this project, I have decided that I 
was complicating the situation by trying to put more than one fiscal year 
in a workbook. It would be much simpler for those that come after me to 
have a workbook for each fiscal year. So, either myself or a moderator can 
delete this thread. I will check back in a few days and see what needs to 
be done.
Harold

On Sunday, September 6, 2015 at 6:54:56 PM UTC-6, Paul Schreiner wrote:
>
> I can see a couple of concerns.
> The LARGEST concern is that "t2" is a variable called t2.
> not the value of the cell T2.
> So, most likely you're not using "Option Explicit" at the start of your 
> code modules.
> Therefore, the first time VBA encounters a variable that has not been 
> declared, it "self-declares" the variable based on how it's used.
>
> For instance:
> VarA = "test" would declare the variable (usually) as Variant or String.
> VarB = 2 would declare the variable as Integer.
>
> So, since you haven't declared t2, it is declared as Variant, with a value 
> of ""
>
> So, (Now() > t2)
> becomes (9/6/2015 8:47:53 PM  > "")
>
> Instead of t2, you need Range("T2").value
>
> Even if you used:
> If (Now() > Range("T2").value)
> you could still have a problem, since VBA may do the comparison based on 
> comparing TEXT STRINGS rather than a date comparison.
>
> When comparing Strings, in this case, it would compare the first 
> characters:
> "9" and "S"
> This isn't what you're looking for.
>
> You need a DATE comparison.
> I'd suggest Datediff()
>
> If ((DateDiff("d", Range("T2").Value, Now()) >= 0) _
> and (DateDiff("d", Range("T3").Value, Now()) < 0)) Then
>
> *Paul*
> -----------------------------------------
>
>
>
>
>
>
>
> *“Do all the good you can,By all the means you can,In all the ways you 
> can,In all the places you can,At all the times you can,To all the people 
> you can,As long as ever you can.” - John Wesley*
> -----------------------------------------
>
> ------------------------------
> *From:* James Williams <hwm...@gmail.com <javascript:>>
> *To:* MS EXCEL AND VBA MACROS <excel-...@googlegroups.com <javascript:>> 
> *Sent:* Saturday, September 5, 2015 4:05 PM
> *Subject:* $$Excel-Macros$$ paste data to a different area of my totals 
> sheet
>
>
>
> I am using Windows 7 64 bit and Excel 2010. My fiscal year starts 
> September 1,2015 and ends August 31,2016. I have entered the date August 
> 31, 2015 into cell T2. I put the date September 1, 2016 into cell T3. Here 
> is the part of my macro that I am having problems with:
>
> If (Now() > t2) And Now() < t3 Then
>  Range("A59").End(xlUp).Select
>  Selection.Offset(1, 0).Select
>  Else
>  Range("A113").End(xlUp).Select
>  Selection.Offset(1, 0).Select
>  End If
>
>
> I would like to paste what I have copied to one part of the totals sheet 
> until the fiscal year changes and then paste the copied cells to another 
> place on the totals sheet. I am basically keeping up with two years of 
> totals for two fiscal years rather than creating a new spreadsheet every 
> year.
> My problem is that my code always skips to the else part of the if 
> statement. Am I using the wrong dates or wrong VBA code or what? 
> -- 
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
> https://www.facebook.com/discussexcel
>  
> FORUM RULES
>  
> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security 
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>  
> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
> members are not responsible for any loss.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to excel-macros...@googlegroups.com <javascript:>.
> To post to this group, send email to excel-...@googlegroups.com 
> <javascript:>.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to