ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Text with Dates (https://www.excelbanter.com/excel-discussion-misc-queries/30834-text-dates.html)

littlegreenmen1

Text with Dates
 

in cell A1 i have some text. in cell B1 i have a date. how do I get
Excel to display both the text and the date. I've tried:

Dim olDate As Range
Dim olText As Range
Set olDate = Sheet1.Cells.Item(1,"A")
Set olText = Sheet1.Cells.Item(1,"B")
.Subject= olText +" - " + olDate

I was hoping to get something like "text - 6/9/05" in the subject bar,
but everytime I do this i get a run time error. i've tried replacing
the date with text and it works just fine, and i've also tried just the
date cell and it works fine. the problem comes up when i try and combine
the date and text. both

Any help would be much appreciated. Thank you in advance.


--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...o&userid=23978
View this thread: http://www.excelforum.com/showthread...hreadid=379323


Bob Phillips

Subject = Sheet1.Range("A1").Value & " - " &
Format(Sheet1.Range("B1").Value,"dd mmm yyyy")

--
HTH

Bob Phillips

"littlegreenmen1"
<littlegreenmen1.1qo86d_1118844311.6037@excelfor um-nospam.com wrote in
message news:littlegreenmen1.1qo86d_1118844311.6037@excelf orum-nospam.com...

in cell A1 i have some text. in cell B1 i have a date. how do I get
Excel to display both the text and the date. I've tried:

Dim olDate As Range
Dim olText As Range
Set olDate = Sheet1.Cells.Item(1,"A")
Set olText = Sheet1.Cells.Item(1,"B")
Subject= olText +" - " + olDate

I was hoping to get something like "text - 6/9/05" in the subject bar,
but everytime I do this i get a run time error. i've tried replacing
the date with text and it works just fine, and i've also tried just the
date cell and it works fine. the problem comes up when i try and combine
the date and text. both

Any help would be much appreciated. Thank you in advance.


--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile:

http://www.excelforum.com/member.php...o&userid=23978
View this thread: http://www.excelforum.com/showthread...hreadid=379323




Dave Peterson

Maybe...

Subject= olText.value & " - " & olDate.text

(I didn't test this.)

littlegreenmen1 wrote:

in cell A1 i have some text. in cell B1 i have a date. how do I get
Excel to display both the text and the date. I've tried:

Dim olDate As Range
Dim olText As Range
Set olDate = Sheet1.Cells.Item(1,"A")
Set olText = Sheet1.Cells.Item(1,"B")
Subject= olText +" - " + olDate

I was hoping to get something like "text - 6/9/05" in the subject bar,
but everytime I do this i get a run time error. i've tried replacing
the date with text and it works just fine, and i've also tried just the
date cell and it works fine. the problem comes up when i try and combine
the date and text. both

Any help would be much appreciated. Thank you in advance.

--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...o&userid=23978
View this thread: http://www.excelforum.com/showthread...hreadid=379323


--

Dave Peterson

littlegreenmen1


Thank y'all both very much. It works perfectly now.


--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile: http://www.excelforum.com/member.php...o&userid=23978
View this thread: http://www.excelforum.com/showthread...hreadid=379323



All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com