#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default format cell

Hi Tim
try
=INT(cell_reference)
and format as date

--
Regards
Frank Kabel
Frankfurt, Germany

Tim wrote:
If a cell says 2.8 for instance and i format that cell to be a date
with format 03/04/97and it comes out showing in the cell 01/03/00 but
the formula and value actually are 01/03/1900 12:05 . How do i make
it so the time is not there( 12:05)

Tried paste special value. did not work


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default format cell

Hi Tim
in which code ? you haven't provided any :-)

--
Regards
Frank Kabel
Frankfurt, Germany

Tim wrote:
Write this in the code frank, i'm not to sure as a beginner.

  #3   Report Post  
Posted to microsoft.public.excel.programming
tim tim is offline
external usenet poster
 
Posts: 105
Default format cell

I aws not sure what to do with the info you gave me, if that was a option on the toolbar or was i supose to place this in one of my macros somehow.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default format cell

Hi Tim
if you post the code of yur existing macro I'll incorporate the
function for you. Though in VBA you have to use
CInt(value) instead of INT (INT is a worksheet function)

--
Regards
Frank Kabel
Frankfurt, Germany

Tim wrote:
I aws not sure what to do with the info you gave me, if that was a
option on the toolbar or was i supose to place this in one of my
macros somehow.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default format cell

Hi
without changing your code in total just add the following lines:
1. At the beginning:
Dim cell as range
dim rng as range

2. And the following before you format the cells
Set rng = RANGE(Cells(1,2),Cells(Rows.Count, "B").End(xlUp))
for each cell in rng
if isnumeric(cell.value) then
cell.value = CInt(cell.value)
end if
next
'do your formating

One note: you probably should replace all Selects with a range
reference (as shown above).


--
Regards
Frank Kabel
Frankfurt, Germany

Tim wrote:
Thanks Frank, the part of the code that formats is at the bottom but
it leaves in that time factor that i talked about.

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 2/24/2004 by Husky User
'
Dim z As Range
Sheets("Eclipse").Select
Range("A1").Select
Cells.Find(What:="time", After:=ActiveCell, LookIn:=xlFormulas,
LookAt _ :=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:= _ False).Activate

Set z = ActiveCell
Cells(z.Row + 3, "B").Select

x = ActiveCell.Address
Selection.End(xlDown).Select
y = ActiveCell.Address
Range(x, y).Select
Application.CutCopyMode = False
Selection.Copy

Sheets("Sheet1").Select
Range("B2").Select
ActiveSheet.Paste
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(cLastRow + 1, "B").Select
ActiveSheet.Paste
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(cLastRow + 1, "B").Select
ActiveSheet.Paste

Sheets("Sheet2").Select
Range("B2").Select
ActiveSheet.Paste
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(cLastRow + 1, "B").Select
ActiveSheet.Paste
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(cLastRow + 1, "B").Select
ActiveSheet.Paste
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(cLastRow + 1, "B").Select
ActiveSheet.Paste
cLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(cLastRow + 1, "B").Select
ActiveSheet.Paste

Sheets("Sheet2").Select
Columns("B:B").Select
Selection.NumberFormat = "mm/dd/yy"

Sheets("Sheet1").Select
Columns("B:B").Select
Selection.NumberFormat = "mm/dd/yy"


End Sub


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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
cell format - remove cell format pattern without effecting colors Bas Excel Discussion (Misc queries) 1 March 23rd 09 02:54 PM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
Excel Auto-Format cell to email format Please Help Me Excel Discussion (Misc queries) 1 March 23rd 06 05:15 PM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM


All times are GMT +1. The time now is 02:55 AM.

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"