Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Edit a cell macro in Microsoft Visal Basic

Hi All:
Trying to edit a cell in Excel 2003 using Microsoft Visual Basic.
I have a cell in "F4" "=now()"
I have copied this cell "F4"
Then "Paste special/Paste - values" into same cell
Which results in say for example "7/9/2006 11:15:00 AM"
Now I'm tryin to write a macro to automatically remove the " 11:15:00 AM"
from the end.

Macro so far is
Range("F4").Select 'Selects the F4 cell
ActiveCell.X 'What is the command to put where the X is?
Thanks in advance for any help.
Cheers Sharpy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Edit a cell macro in Microsoft Visal Basic

Hi Sharpy,

Try:

'=============
Public Sub Tester001()

With Range("F4")
.NumberFormat = "dd/mm/yy"
.Value = Date
End With

End Sub
'<<=============

--
---
Regards,
Norman



"Sharpy" wrote in message
...
Hi All:
Trying to edit a cell in Excel 2003 using Microsoft Visual Basic.
I have a cell in "F4" "=now()"
I have copied this cell "F4"
Then "Paste special/Paste - values" into same cell
Which results in say for example "7/9/2006 11:15:00 AM"
Now I'm tryin to write a macro to automatically remove the " 11:15:00 AM"
from the end.

Macro so far is
Range("F4").Select 'Selects the F4 cell
ActiveCell.X 'What is the command to put where the X is?
Thanks in advance for any help.
Cheers Sharpy




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Edit a cell macro in Microsoft Visal Basic

=now() will always give you the date AND time.
=today() will just give you the date.
susan


Norman Jones wrote:
Hi Sharpy,

Try:

'=============
Public Sub Tester001()

With Range("F4")
.NumberFormat = "dd/mm/yy"
.Value = Date
End With

End Sub
'<<=============

--
---
Regards,
Norman



"Sharpy" wrote in message
...
Hi All:
Trying to edit a cell in Excel 2003 using Microsoft Visual Basic.
I have a cell in "F4" "=now()"
I have copied this cell "F4"
Then "Paste special/Paste - values" into same cell
Which results in say for example "7/9/2006 11:15:00 AM"
Now I'm tryin to write a macro to automatically remove the " 11:15:00 AM"
from the end.

Macro so far is
Range("F4").Select 'Selects the F4 cell
ActiveCell.X 'What is the command to put where the X is?
Thanks in advance for any help.
Cheers Sharpy



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
Microsoft Visual Basic errors displaid when opening Microsoft Word 97 & Excel (7 JJ mac Setting up and Configuration of Excel 7 June 14th 07 06:54 PM
Microsoft Visual Basic ecpl_3 Excel Programming 1 November 11th 05 07:56 PM
converting formulas into values using a macro in visual basic edit F.C[_2_] Excel Programming 1 August 28th 05 09:52 AM
When you edit a macro in visual basic editor, why doesn't it upda. [email protected] Excel Programming 1 March 8th 05 04:19 PM
microsoft visual basic Yusuf Patel Excel Programming 1 November 20th 04 03:24 PM


All times are GMT +1. The time now is 07:05 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"