PC Review


Reply
Thread Tools Rate Thread

Copy time from one column to another in a macro

 
 
=?Utf-8?B?Um9iZXJ0IEIu?=
Guest
Posts: n/a
 
      14th Oct 2007
I am trying to create a simple worksheet to log people in / out + in/out when
going to lunch . I need help with code below. Computer asks me to ENTER or
SELECT destination and press ENTER or choose PASTE. When I press ESC on
keyboard the question goes away. Is there a way to tell VBA to press ESC to
correct this problem? If there is a more simple way please advise.

Column A - Name
Column B - Where check goes to say person arrived
Column C - Looks at Column B if checked (NOW())
Column D - Macro copies time from C and pastes as a value
Column E - Repeat of B-D (for Out to Lunch, In from Lunch, Dep. for Day)

Thanks for any help

Robert

Application.ScreenUpdating = False
ActiveCell.FormulaR1C1 = "R"
ActiveCell.Offset(0, 1).Select
Selection.Copy
ActiveCell.Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.OnKey "{ENTER}"
Range("AZ1").Select
ActiveCell.FormulaR1C1 = "=+TODAY()"
Range("A1").Select
ActiveCell.Select

End Sub
 
Reply With Quote
 
 
 
 
Doug Glancy
Guest
Posts: n/a
 
      14th Oct 2007
Robert,

To clear the clipboard, put this in your code:

application.CutCopyMode = false

hth,

Doug

"Robert B." <Robert B.@discussions.microsoft.com> wrote in message
news:720FCF1E-2FA2-4510-B327-(E-Mail Removed)...
>I am trying to create a simple worksheet to log people in / out + in/out
>when
> going to lunch . I need help with code below. Computer asks me to ENTER
> or
> SELECT destination and press ENTER or choose PASTE. When I press ESC on
> keyboard the question goes away. Is there a way to tell VBA to press ESC
> to
> correct this problem? If there is a more simple way please advise.
>
> Column A - Name
> Column B - Where check goes to say person arrived
> Column C - Looks at Column B if checked (NOW())
> Column D - Macro copies time from C and pastes as a value
> Column E - Repeat of B-D (for Out to Lunch, In from Lunch, Dep. for Day)
>
> Thanks for any help
>
> Robert
>
> Application.ScreenUpdating = False
> ActiveCell.FormulaR1C1 = "R"
> ActiveCell.Offset(0, 1).Select
> Selection.Copy
> ActiveCell.Offset(0, 1).Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks _
> :=False, Transpose:=False
> Application.OnKey "{ENTER}"
> Range("AZ1").Select
> ActiveCell.FormulaR1C1 = "=+TODAY()"
> Range("A1").Select
> ActiveCell.Select
>
> End Sub


 
Reply With Quote
 
=?Utf-8?B?Um9iZXJ0IEIu?=
Guest
Posts: n/a
 
      14th Oct 2007
Mr. Glancy,

Thanks much for the code below. It worked perfectly. I have another
question. I currently have to select each of the four cells (Entry,Exit, Out
to Lunch or In from Lunch) by clicking on cell in left side. The right side
of each cell I have a transparent rectangle attached to the marcro. Is
there a way to make it when I click anywhere in each of the cells listed
above it will activate the macro?

Thanks for any help you can provide.

Robert
"Doug Glancy" wrote:

> Robert,
>
> To clear the clipboard, put this in your code:
>
> application.CutCopyMode = false
>
> hth,
>
> Doug
>
> "Robert B." <Robert B.@discussions.microsoft.com> wrote in message
> news:720FCF1E-2FA2-4510-B327-(E-Mail Removed)...
> >I am trying to create a simple worksheet to log people in / out + in/out
> >when
> > going to lunch . I need help with code below. Computer asks me to ENTER
> > or
> > SELECT destination and press ENTER or choose PASTE. When I press ESC on
> > keyboard the question goes away. Is there a way to tell VBA to press ESC
> > to
> > correct this problem? If there is a more simple way please advise.
> >
> > Column A - Name
> > Column B - Where check goes to say person arrived
> > Column C - Looks at Column B if checked (NOW())
> > Column D - Macro copies time from C and pastes as a value
> > Column E - Repeat of B-D (for Out to Lunch, In from Lunch, Dep. for Day)
> >
> > Thanks for any help
> >
> > Robert
> >
> > Application.ScreenUpdating = False
> > ActiveCell.FormulaR1C1 = "R"
> > ActiveCell.Offset(0, 1).Select
> > Selection.Copy
> > ActiveCell.Offset(0, 1).Select
> > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> > SkipBlanks _
> > :=False, Transpose:=False
> > Application.OnKey "{ENTER}"
> > Range("AZ1").Select
> > ActiveCell.FormulaR1C1 = "=+TODAY()"
> > Range("A1").Select
> > ActiveCell.Select
> >
> > End Sub

>
>

 
Reply With Quote
 
Doug Glancy
Guest
Posts: n/a
 
      16th Oct 2007
Robert,

Take a look at the Worksheet_SelectionChange event. Look it up in Help or
Google it. I think it will do what you want. Sorry, don't have time for
more now.

Doug

"Robert B." <(E-Mail Removed)> wrote in message
news:2B175B4A-0A52-4AEC-8B06-(E-Mail Removed)...
> Mr. Glancy,
>
> Thanks much for the code below. It worked perfectly. I have another
> question. I currently have to select each of the four cells (Entry,Exit,
> Out
> to Lunch or In from Lunch) by clicking on cell in left side. The right
> side
> of each cell I have a transparent rectangle attached to the marcro. Is
> there a way to make it when I click anywhere in each of the cells listed
> above it will activate the macro?
>
> Thanks for any help you can provide.
>
> Robert
> "Doug Glancy" wrote:
>
>> Robert,
>>
>> To clear the clipboard, put this in your code:
>>
>> application.CutCopyMode = false
>>
>> hth,
>>
>> Doug
>>
>> "Robert B." <Robert B.@discussions.microsoft.com> wrote in message
>> news:720FCF1E-2FA2-4510-B327-(E-Mail Removed)...
>> >I am trying to create a simple worksheet to log people in / out + in/out
>> >when
>> > going to lunch . I need help with code below. Computer asks me to
>> > ENTER
>> > or
>> > SELECT destination and press ENTER or choose PASTE. When I press ESC
>> > on
>> > keyboard the question goes away. Is there a way to tell VBA to press
>> > ESC
>> > to
>> > correct this problem? If there is a more simple way please advise.
>> >
>> > Column A - Name
>> > Column B - Where check goes to say person arrived
>> > Column C - Looks at Column B if checked (NOW())
>> > Column D - Macro copies time from C and pastes as a value
>> > Column E - Repeat of B-D (for Out to Lunch, In from Lunch, Dep. for
>> > Day)
>> >
>> > Thanks for any help
>> >
>> > Robert
>> >
>> > Application.ScreenUpdating = False
>> > ActiveCell.FormulaR1C1 = "R"
>> > ActiveCell.Offset(0, 1).Select
>> > Selection.Copy
>> > ActiveCell.Offset(0, 1).Select
>> > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
>> > SkipBlanks _
>> > :=False, Transpose:=False
>> > Application.OnKey "{ENTER}"
>> > Range("AZ1").Select
>> > ActiveCell.FormulaR1C1 = "=+TODAY()"
>> > Range("A1").Select
>> > ActiveCell.Select
>> >
>> > End Sub

>>
>>


 
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
Modify a Macro - Copy Tab Name and Add To Column A ScottMsp Microsoft Excel Programming 1 1st Jul 2009 09:54 PM
Copy 3 columns become one column with macro Lyn Microsoft Excel Programming 6 7th Sep 2008 12:28 AM
A formula or macro that will place the date in an adjacent column Bany time something is typed in column A Mike C Microsoft Excel Programming 4 27th Feb 2008 01:57 AM
Macro to copy data down a column Neddy Microsoft Excel Programming 3 23rd Mar 2006 07:55 PM
Write a macro ro copy column at certain time of day. Daytrader Microsoft Excel Programming 4 2nd Feb 2004 05:28 AM


Features
 

Advertising
 

Newsgroups
 


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