Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
date based question
hello,
i need to copy a date formatted as "yyyymmdd" (preferably as a string). each time i copy it, i copy the mm/dd/yyyy format when i copy cells (x,y).value or any other form. any tips would be a huge help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
date based question
Since you posted to a programming newsgroup, I assume your question is
asking for a VB solution... use the Text property of the Range or Cells objects to get the text that is in the cell instead of its underlying value. For example, if A1 contains a date formatted as you indicated, then this will copy the displayed text into the cell B1... Range("B1").Valued = Range("A1").Text -- Rick (MVP - Excel) "jason" wrote in message ... hello, i need to copy a date formatted as "yyyymmdd" (preferably as a string). each time i copy it, i copy the mm/dd/yyyy format when i copy cells (x,y).value or any other form. any tips would be a huge help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
date based question
On Aug 10, 11:30*am, "Rick Rothstein"
wrote: Since you posted to a programming newsgroup, I assume your question is asking for a VB solution... use the Text property of the Range or Cells objects to get the text that is in the cell instead of its underlying value. For example, if A1 contains a date formatted as you indicated, then this will copy the displayed text into the cell B1... Range("B1").Valued = Range("A1").Text -- Rick (MVP - Excel) "jason" wrote in message ... hello, i need to copy a date formatted as "yyyymmdd" (preferably as a string). each time i copy it, i copy the mm/dd/yyyy format when i copy cells (x,y).value or any other form. any tips would be a huge help- Hide quoted text - - Show quoted text - very great. thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
date based question
On Aug 10, 11:30*am, "Rick Rothstein"
wrote: Since you posted to a programming newsgroup, I assume your question is asking for a VB solution... use the Text property of the Range or Cells objects to get the text that is in the cell instead of its underlying value. For example, if A1 contains a date formatted as you indicated, then this will copy the displayed text into the cell B1... Range("B1").Valued = Range("A1").Text -- Rick (MVP - Excel) "jason" wrote in message ... hello, i need to copy a date formatted as "yyyymmdd" (preferably as a string). each time i copy it, i copy the mm/dd/yyyy format when i copy cells (x,y).value or any other form. any tips would be a huge help- Hide quoted text - - Show quoted text - exactly what i need. thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
date based question
On Aug 10, 12:15*pm, jason wrote:
On Aug 10, 11:30*am, "Rick Rothstein" wrote: Since you posted to a programming newsgroup, I assume your question is asking for a VB solution... use the Text property of the Range or Cells objects to get the text that is in the cell instead of its underlying value. For example, if A1 contains a date formatted as you indicated, then this will copy the displayed text into the cell B1... Range("B1").Valued = Range("A1").Text -- Rick (MVP - Excel) "jason" wrote in message .... hello, i need to copy a date formatted as "yyyymmdd" (preferably as a string). each time i copy it, i copy the mm/dd/yyyy format when i copy cells (x,y).value or any other form. any tips would be a huge help- Hide quoted text - - Show quoted text - exactly what i need. thanks- Hide quoted text - - Show quoted text - actually not working. code: dim q q=1 cells(2,2)=1 cells(3,2)=1 cells(4,3)=2009 Worksheets("Sheet1").Cells(5, q + 1) = Worksheets ("Sheet1").Cells(2, q + 1) & "/" & Worksheets("Sheet1").Cells(3, q + 1) & "/" & Worksheets("Sheet1").Cells(4, q + 1) Worksheets("Sheet1").Cells(5, q + 1).NumberFormat = "m/d/ yy;@" Worksheets("Sheet1").Cells(6, q + 1).Value = Worksheets ("Sheet1").Cells(5, q + 1).Text |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
date based question
For the example you gave, this cell...
Worksheets("Sheet1").Cells(4, q + 1) has nothing in it. I think the problem goes back to this statement... Cells(4, 3) = 2009 In particular, the 3... your previous statements use 2 for the column. Was the 3 a mistake? If you change it to 2, the code you posted appears to work correctly. As an unrelated aside, you should consider prefacing all the cell references with your worksheet reference, not just some of them. -- Rick (MVP - Excel) "jason" wrote in message ... On Aug 10, 12:15 pm, jason wrote: On Aug 10, 11:30 am, "Rick Rothstein" wrote: Since you posted to a programming newsgroup, I assume your question is asking for a VB solution... use the Text property of the Range or Cells objects to get the text that is in the cell instead of its underlying value. For example, if A1 contains a date formatted as you indicated, then this will copy the displayed text into the cell B1... Range("B1").Valued = Range("A1").Text -- Rick (MVP - Excel) "jason" wrote in message ... hello, i need to copy a date formatted as "yyyymmdd" (preferably as a string). each time i copy it, i copy the mm/dd/yyyy format when i copy cells (x,y).value or any other form. any tips would be a huge help- Hide quoted text - - Show quoted text - exactly what i need. thanks- Hide quoted text - - Show quoted text - actually not working. code: dim q q=1 cells(2,2)=1 cells(3,2)=1 cells(4,3)=2009 Worksheets("Sheet1").Cells(5, q + 1) = Worksheets ("Sheet1").Cells(2, q + 1) & "/" & Worksheets("Sheet1").Cells(3, q + 1) & "/" & Worksheets("Sheet1").Cells(4, q + 1) Worksheets("Sheet1").Cells(5, q + 1).NumberFormat = "m/d/ yy;@" Worksheets("Sheet1").Cells(6, q + 1).Value = Worksheets ("Sheet1").Cells(5, q + 1).Text |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatically update a cell with a date based on anther cells date | Excel Discussion (Misc queries) | |||
Sumproduct based which also weights data based on date | Excel Worksheet Functions | |||
copy date based on date -refer to date range | Excel Programming | |||
VBA that automatically generates a series of cash flows based on a start date, an end date and frequency | Excel Programming | |||
Using formulas to determine date in one cell based on date in anot | Excel Worksheet Functions |