LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 145
Default how to use variable that should be in "quotes"

Hi,

I have a small piece of VBA which is used to filter a list (using a custom
autofilter) between 2 sets of dates from input boxes (code below). my
problem is that it doesn't filter the list properly (hides all the data). i
think its because the criteria (rng1 & rng2) in the autofilter should be in
quotes, but i don't know how to do that... i can't work out how to make
another variable which is a concatenation of " & rng1 & "

could someone please help me (or tell me an easier way to aceive the same
thing!)?

Thanks,

Tim
======
Sub ChooseDates()
Dim rng1 As Date, rng2 As Date

rng1 = InputBox("from")
rng2 = InputBox("to")

Selection.AutoFilter Field:=3, Criteria1:=rng1, Operator:=xlAnd,
Criteria2:=rng2
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
MSN stock quotes - Error message "problem displaying attributes" jd Excel Discussion (Misc queries) 0 November 13th 07 10:34 PM
"Type mismatch" when I try to fill an Array variable with "+" [email protected] Excel Discussion (Misc queries) 1 April 17th 07 01:28 PM
"formula is too long" AND test for whether double-quotes are next-to text or number?? The Moose Excel Discussion (Misc queries) 2 September 14th 06 05:29 AM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM


All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"