Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Macro Strings

Hello, I am trying to use the concatenate operator to
combine 3 different individual strings with numbers in
them into one string. Something like this:

month = xx
day = xx
year = xx

date = month & "/" & day & "/" & year

But this doesn't work. Is this the correct operator to
use for this kind of purpose and I am just using it
incorrectly? Or is there a whole other way and I am
missing something?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Excel Macro Strings

Brandon,

My first suggestion would be to use different variable names, month, day and
year are functions and date is a property. Try your code again with things
like myMonth, myDay, myYear and myDate, if it still acts up, post back

Dan E

"Brandon" wrote in message
...
Hello, I am trying to use the concatenate operator to
combine 3 different individual strings with numbers in
them into one string. Something like this:

month = xx
day = xx
year = xx

date = month & "/" & day & "/" & year

But this doesn't work. Is this the correct operator to
use for this kind of purpose and I am just using it
incorrectly? Or is there a whole other way and I am
missing something?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Macro Strings

Yes, I did that already, the month/day/year was just for
showing what kind of number I am using to try and convert
into a date. Any other ideas?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Excel Macro Strings

It looks correct to me then, what is the problem, does it output something
incorrect, nothing at all, etc . . . Perhaps a little more description would
help.

Dan E

"Brandon" wrote in message
...
Yes, I did that already, the month/day/year was just for
showing what kind of number I am using to try and convert
into a date. Any other ideas?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Macro Strings

Just that there is an error. Program execution breaks on
that line and the debugger highlights in yellow with a
vague error message.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Excel Macro Strings

Post the "vague error message"

Dan E

"Brandon" wrote in message
...
Just that there is an error. Program execution breaks on
that line and the debugger highlights in yellow with a
vague error message.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel Macro Strings

myday = 10
mymonth = 5
myyear = 2003
? mymonth & "/" & myday & "/" & myyear
5/10/2003
? cdate(mymonth & "/" & myday & "/" & myyear)
5/10/2003
? format(cdate(mymonth & "/" & myday & "/" & myyear),"mmm dd, yyyy")
May 10, 2003

What is "date" dimensioned as

Sub testdate()
Dim dtDate As Date
myday = 10
mymonth = 5
myyear = 2003
dtDate = mymonth & "/" & myday & "/" & myyear
Debug.Print dtDate
End Sub

worked.

You can try
msgbox isdate(mymonth & "/" & myday & "/" & myyear) & " " & _
mymonth & "/" & myday & "/" & myyear


to see if vba sees your string as a date

Regards,
Tom Ogilvy


"Brandon" wrote in message
...
Just that there is an error. Program execution breaks on
that line and the debugger highlights in yellow with a
vague error message.



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 and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Parsing Name Strings In Excel Cliff-D Excel Discussion (Misc queries) 0 June 10th 10 02:02 AM
Macro to apply parsing rules for strings and list the substrings Luciano Paulino da Silva Excel Worksheet Functions 25 May 3rd 09 11:53 AM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM
How can I count strings within strings Paul W Excel Worksheet Functions 4 June 14th 05 12:39 PM


All times are GMT +1. The time now is 10:42 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"