Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date Format Problem | Excel Discussion (Misc queries) | |||
Excel Format Problem - Date Overrides Format | Excel Discussion (Misc queries) | |||
Date format problem | Excel Worksheet Functions | |||
date format problem | Excel Discussion (Misc queries) | |||
Date Format problem | Excel Programming |