PC Review


Reply
Thread Tools Rate Thread

Edit a cell macro in Microsoft Visal Basic

 
 
Sharpy
Guest
Posts: n/a
 
      7th Nov 2006
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 With Quote
 
 
 
 
Norman Jones
Guest
Posts: n/a
 
      7th Nov 2006
Hi Sharpy,

Try:

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

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

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

--
---
Regards,
Norman



"Sharpy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
 
Susan
Guest
Posts: n/a
 
      7th Nov 2006
=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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 With Quote
 
Sharpy
Guest
Posts: n/a
 
      14th Nov 2006
Thanks Norman that tip worked great
Cheers Sharpy

"Norman Jones" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi Sharpy,
>
> Try:
>
> '=============>>
> Public Sub Tester001()
>
> With Range("F4")
> .NumberFormat = "dd/mm/yy"
> .Value = Date
> End With
>
> End Sub
> '<<=============
>
> --
> ---
> Regards,
> Norman
>
>
>
> "Sharpy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visal Basic corruption cmtrain via AccessMonster.com Microsoft Access Macros 2 8th May 2007 01:05 AM
How do I run a Macro on basic of a value in a specific cell =?Utf-8?B?U3RlZW4gSC4gUGVkZXJzZW4=?= Microsoft Excel Worksheet Functions 3 16th Apr 2005 08:52 AM
When you edit a macro in visual basic editor, why doesn't it upda. =?Utf-8?B?a2ZyaWNrQHZnMzAyLm9yZw==?= Microsoft Excel Programming 1 8th Mar 2005 04:19 PM
Macro to edit cell Kevin Microsoft Excel Misc 1 21st Aug 2003 06:05 PM
Edit Cell Macro Tyler McLean Microsoft Excel Discussion 2 31st Jul 2003 08:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:30 PM.