just a vb line i need correct parentheses

fenster

Board Regular
Joined
Nov 11, 2002
Messages
98
finish = "<=" & Sheet4.Cells.Range("$D$4").Value & DateSerial(Year(Date), Month(Date) + 1, 1)


the above line is causing me all kinds of bother with the autofilter.

its a long story but heres what i need:

these lines of code in correct parentheses:

finish = "<=" & Sheet4.Cells.Range("$D$4").Value + DateSerial(Year(Date)

finish = "<=" & Sheet4.Cells.Range("$D$4").Value + Month(Date) + 1, 1)

can anyone help -

davie..

btw
thanks for looking ;)
 
ok lets pretend for a moment that im a newbie at coding!!


how do i make

Dim Start As Date
Dim finish As Date

long integer?
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
jmiskey said:
Andrew,

Thanks for the pick-up. We were working on it a while yesterday, and we figured out that the problem was with the dates. The problem is that I am in the U.S., so I couldn't recreate the situation, so I couldn't develop and test possible solutions. I thought that maybe changing the dates to strings might work(?). I see the Long Integer solution worked.

We get lots of problems with dates and VBA in the UK, when the day and month are ambiguous. In the thread I posted I could recreate the (annoying) problem. Hope my solution works.
 
Upvote 0
Man That was easy!!! Works Like A Charm!!!


so if im dealing with dates for these kinda things always make em long integer?

StartDate = CLng(Range("D4").Value)
EndDate = CLng(Range("G4").Value)

and things should be ok?

Thanks jmiskey for ALL of your help on this one - and u andrew!
 
Upvote 0
Thank you, Andrew, for providing the last piece of the puzzle!

Fenster, if you see Andrew's last post, it looks like these problems are quite common in UK versions of VBA. So, yes, this should be a good work around for this situation.

Hopefully, with all the work we went through yesterday, you learned some VBA debugging tips that might help you down the road!
 
Upvote 0
Thats a very good point u made and one more board gurus,addicts,MVPs should attempt to follow for newbies...

when u were helping me through this problem u always explained why something should be , like the tip on quotes being no longer a variable, but treated as literal text and the macros for testing conditions..

also the fact that u saw it out to the bitter end has to be applauded!

i can honestly say that ive learned lots over the last 2 days from the threads , ive always found this forum great to post in.

i learned SUMPRODUCT also for counting between dates here last month!
I Have Aladin Akyurek to thank for that 1!

Now im off to get out of my depth in some more VB.(theres no place i would rather be)

thanks again

Davie.
 
Upvote 0

Forum statistics

Threads
1,221,701
Messages
6,161,381
Members
451,700
Latest member
Eccymarge

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top