Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
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
Find Method Garry Douglas Excel Programming 0 December 31st 04 02:31 AM
with -.find end with method Peter[_21_] Excel Programming 1 December 26th 04 11:49 AM
Find method benb Excel Programming 0 September 22nd 04 09:19 PM
Using Find method wade Excel Programming 3 March 3rd 04 07:05 AM
The Find Method Dick Kusleika Excel Programming 3 July 16th 03 07:59 PM


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

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

About Us

"It's about Microsoft Excel"