Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variables to make a date and using find method to find that.
I have the month in a variable "mon1", the day in a variable "day1" , and the
year in a variable "year1". I need to use the find method to find this specific date and here is the code I am using... Set wks = ActiveSheet Set rngSearch = wks.Cells Set rngFound = rngSearch.Find("mon1 / day1 / year1") Debug.Print rngFound.Address This doesn't work. But if I use "4/1/2005" in place of the variables it works just fine. What do I need to do to make this work? Thanks!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variables to make a date and using find method to find that.
Your string in quotes was treated as literally a string "mon1/day1/year1" and not as variables concatenated with "/". Use: Set rngFound = rngSearch.Find(mon1 & "/ " & day1 & "/ " & year1) HTH "KyWilde" wrote: I have the month in a variable "mon1", the day in a variable "day1" , and the year in a variable "year1". I need to use the find method to find this specific date and here is the code I am using... Set wks = ActiveSheet Set rngSearch = wks.Cells Set rngFound = rngSearch.Find("mon1 / day1 / year1") Debug.Print rngFound.Address This doesn't work. But if I use "4/1/2005" in place of the variables it works just fine. What do I need to do to make this work? Thanks!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variables to make a date and using find method to find t
Thank you Toppers...!!!
"Toppers" wrote: Your string in quotes was treated as literally a string "mon1/day1/year1" and not as variables concatenated with "/". Use: Set rngFound = rngSearch.Find(mon1 & "/ " & day1 & "/ " & year1) HTH "KyWilde" wrote: I have the month in a variable "mon1", the day in a variable "day1" , and the year in a variable "year1". I need to use the find method to find this specific date and here is the code I am using... Set wks = ActiveSheet Set rngSearch = wks.Cells Set rngFound = rngSearch.Find("mon1 / day1 / year1") Debug.Print rngFound.Address This doesn't work. But if I use "4/1/2005" in place of the variables it works just fine. What do I need to do to make this work? Thanks!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find Method | Excel Programming | |||
with -.find end with method | Excel Programming | |||
Find method | Excel Programming | |||
Using Find method | Excel Programming | |||
The Find Method | Excel Programming |