Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Date FORMAT problem

I am trying to copy data from one worksheet to another worksheet, I am using
the following code:


Range("sheetname1!A1").value = range("sheetname2!A1).value

But everytime it is putting the data in as a date going from one worksheet
to the other worksheet, I want the data to be text only and not convert it
into a date.

Is there any easier way to copy a range of cells from one worksheet to
another worksheet?

The hardiest problem I am having is finding the syntax I need to use.

Thanks!




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Date FORMAT problem

Eric,

try this instead
Range("sheetname1!A1").value =
Application.worksheetfunction.Text(range("sheetnam e2!A1).value,"mm/dd/yyyy")

you can change the 'format' string to macth your need.

Chill!
Phaedrus

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date FORMAT problem


Hello Eric,

Try using this syntax...

Worksheets("Sheet1").Range("A1").Value =
Worksheets("Sheet2").Range("A1").Value

Substitute your worksheet names for Sheet1 and Sheet2 if the are
different. Also make sure the cell format on the second sheet is the
same as the first sheet.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=492323

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Date FORMAT problem

I tried this, I have numbers like this 11-10-05, when it copies the data
from worksheet1 to worksheet2, when it puts the data in worksheet two it
shows up as date formatted, I don't want this to happen. I want the data
to be the same in both worksheets.




"Leith Ross" wrote
in message ...

Hello Eric,

Try using this syntax...

Worksheets("Sheet1").Range("A1").Value =
Worksheets("Sheet2").Range("A1").Value

Substitute your worksheet names for Sheet1 and Sheet2 if the are
different. Also make sure the cell format on the second sheet is the
same as the first sheet.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=492323





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Date FORMAT problem

Maybe just changing the format of the cells to match would work:

with worksheets("sheet2").range("a1")
.numberformat = worksheets("Sheet1").range("a1").numberformat
.value = worksheets("sheet1").range("a1").value
end with

or if you really don't want it to be a date:

with worksheets("sheet2").range("a1")
.numberformat = "@" 'text
.value = worksheets("sheet1").range("a1").text
end with



"Sabo, Eric" wrote:

I am trying to copy data from one worksheet to another worksheet, I am using
the following code:

Range("sheetname1!A1").value = range("sheetname2!A1).value

But everytime it is putting the data in as a date going from one worksheet
to the other worksheet, I want the data to be text only and not convert it
into a date.

Is there any easier way to copy a range of cells from one worksheet to
another worksheet?

The hardiest problem I am having is finding the syntax I need to use.

Thanks!


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Date FORMAT problem

Dave,
That still didn't work, it still places the values in date format.



"Dave Peterson" wrote in message
...
Maybe just changing the format of the cells to match would work:

with worksheets("sheet2").range("a1")
.numberformat = worksheets("Sheet1").range("a1").numberformat
.value = worksheets("sheet1").range("a1").value
end with

or if you really don't want it to be a date:

with worksheets("sheet2").range("a1")
.numberformat = "@" 'text
.value = worksheets("sheet1").range("a1").text
end with



"Sabo, Eric" wrote:

I am trying to copy data from one worksheet to another worksheet, I am
using
the following code:

Range("sheetname1!A1").value = range("sheetname2!A1).value

But everytime it is putting the data in as a date going from one
worksheet
to the other worksheet, I want the data to be text only and not convert
it
into a date.

Is there any easier way to copy a range of cells from one worksheet to
another worksheet?

The hardiest problem I am having is finding the syntax I need to use.

Thanks!


--

Dave Peterson




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Date FORMAT problem

What do you want to see?

if you want the serial number for that date, ...

with worksheets("sheet2").range("a1")
.numberformat = "General"
.value = worksheets("sheet1").range("a1").value2
end with



"Sabo, Eric" wrote:

Dave,
That still didn't work, it still places the values in date format.

"Dave Peterson" wrote in message
...
Maybe just changing the format of the cells to match would work:

with worksheets("sheet2").range("a1")
.numberformat = worksheets("Sheet1").range("a1").numberformat
.value = worksheets("sheet1").range("a1").value
end with

or if you really don't want it to be a date:

with worksheets("sheet2").range("a1")
.numberformat = "@" 'text
.value = worksheets("sheet1").range("a1").text
end with



"Sabo, Eric" wrote:

I am trying to copy data from one worksheet to another worksheet, I am
using
the following code:

Range("sheetname1!A1").value = range("sheetname2!A1).value

But everytime it is putting the data in as a date going from one
worksheet
to the other worksheet, I want the data to be text only and not convert
it
into a date.

Is there any easier way to copy a range of cells from one worksheet to
another worksheet?

The hardiest problem I am having is finding the syntax I need to use.

Thanks!


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Date FORMAT problem

Finally, I made it work...

use this
Range("sheetname1!A1").value = "'" & range("sheetname2!A1).value

i.e. a single quote between two double-quote marks prefixed to the
value

this will surely work...
Chill!
Phaedrus

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Date FORMAT problem

Thank you very much!

That worked!

"Phaedrus" wrote in message
ups.com...
Finally, I made it work...

use this
Range("sheetname1!A1").value = "'" & range("sheetname2!A1).value

i.e. a single quote between two double-quote marks prefixed to the
value

this will surely work...
Chill!
Phaedrus





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
Date Format Problem Alain Excel Discussion (Misc queries) 2 May 31st 10 04:53 PM
Excel Format Problem - Date Overrides Format Mary Excel Discussion (Misc queries) 5 February 10th 10 05:49 AM
Date format problem Natalie Excel Worksheet Functions 4 June 7th 07 01:28 PM
date format problem Nigel Excel Discussion (Misc queries) 7 May 11th 05 12:57 PM
Date Format problem SW[_5_] Excel Programming 3 March 4th 05 08:27 AM


All times are GMT +1. The time now is 04:10 AM.

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"