Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default cut and paste macro

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default cut and paste macro

Not knowing where to start or how to tell which week is which, how about a
routine that will copy one of the rows when you double-click on a cell in
column D (in the rows from 6-35)?

This needs to go into the sheet's event code for _BeforeDoubleClick()
for help in getting it in there, if you need it:
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range

Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteAll
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True

End Sub

"wally" wrote:

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default cut and paste macro

I am a novice about the procedure you are telling me about. I am not
sure exactly what I am supposed to do. Are you saying I would double
click on a cell, i.e., D6, or d7 or d8, etc and it would copy and paste
the row of numbers to cell d59?. A double click sounds like a viable
solution. But, how do I get this into the macro mode? I looked at the
web site referenced but it is way over my head even to begin with.
Thanks,
JLatham (removethis) wrote:
Not knowing where to start or how to tell which week is which, how about a
routine that will copy one of the rows when you double-click on a cell in
column D (in the rows from 6-35)?

This needs to go into the sheet's event code for _BeforeDoubleClick()
for help in getting it in there, if you need it:
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range

Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteAll
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True

End Sub

"wally" wrote:

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default cut and paste macro

Wally,
Exactly right - double-click in any cell from D6 to D36 and all the
information on that row from D on out to where ever it ends will be copied
down to C59. What is at C59 will be overwritten.

Here is the easy way to insert the code:
Go to the sheet where your information is at.
Right-Click on the sheet tab (right on the name) and a list will come up,
choose [View Code] from the list. The Visual Basic Editor will open up and
show you a pretty much blank white page.
Cut and paste the code below right in to it. Don't copy from the earlier
post of mine, the first line will cause an error, I've rewritten that line
here so that the run over into a second line won't cause you any problem.

Then just close the VB Editor like any window- X at upper right. And you'll
be ready to use it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range
Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteValues
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub

"wally" wrote:

I am a novice about the procedure you are telling me about. I am not
sure exactly what I am supposed to do. Are you saying I would double
click on a cell, i.e., D6, or d7 or d8, etc and it would copy and paste
the row of numbers to cell d59?. A double click sounds like a viable
solution. But, how do I get this into the macro mode? I looked at the
web site referenced but it is way over my head even to begin with.
Thanks,
JLatham (removethis) wrote:
Not knowing where to start or how to tell which week is which, how about a
routine that will copy one of the rows when you double-click on a cell in
column D (in the rows from 6-35)?

This needs to go into the sheet's event code for _BeforeDoubleClick()
for help in getting it in there, if you need it:
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range

Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteAll
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True

End Sub

"wally" wrote:

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default cut and paste macro

Works great!! Thanks for your prompt and informative reply.
Wally
JLatham (removethis) wrote:
Wally,
Exactly right - double-click in any cell from D6 to D36 and all the
information on that row from D on out to where ever it ends will be copied
down to C59. What is at C59 will be overwritten.

Here is the easy way to insert the code:
Go to the sheet where your information is at.
Right-Click on the sheet tab (right on the name) and a list will come up,
choose [View Code] from the list. The Visual Basic Editor will open up and
show you a pretty much blank white page.
Cut and paste the code below right in to it. Don't copy from the earlier
post of mine, the first line will cause an error, I've rewritten that line
here so that the run over into a second line won't cause you any problem.

Then just close the VB Editor like any window- X at upper right. And you'll
be ready to use it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range
Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteValues
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub

"wally" wrote:

I am a novice about the procedure you are telling me about. I am not
sure exactly what I am supposed to do. Are you saying I would double
click on a cell, i.e., D6, or d7 or d8, etc and it would copy and paste
the row of numbers to cell d59?. A double click sounds like a viable
solution. But, how do I get this into the macro mode? I looked at the
web site referenced but it is way over my head even to begin with.
Thanks,
JLatham (removethis) wrote:
Not knowing where to start or how to tell which week is which, how about a
routine that will copy one of the rows when you double-click on a cell in
column D (in the rows from 6-35)?

This needs to go into the sheet's event code for _BeforeDoubleClick()
for help in getting it in there, if you need it:
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range

Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteAll
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True

End Sub

"wally" wrote:

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb







  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default cut and paste macro

Glad to hear it. Thanks. Just be aware that sometimes, if you're slow on
the double-click, Excel won't see it as a double-click, just as 2 clicks.

"wally" wrote:

Works great!! Thanks for your prompt and informative reply.
Wally
JLatham (removethis) wrote:
Wally,
Exactly right - double-click in any cell from D6 to D36 and all the
information on that row from D on out to where ever it ends will be copied
down to C59. What is at C59 will be overwritten.

Here is the easy way to insert the code:
Go to the sheet where your information is at.
Right-Click on the sheet tab (right on the name) and a list will come up,
choose [View Code] from the list. The Visual Basic Editor will open up and
show you a pretty much blank white page.
Cut and paste the code below right in to it. Don't copy from the earlier
post of mine, the first line will cause an error, I've rewritten that line
here so that the run over into a second line won't cause you any problem.

Then just close the VB Editor like any window- X at upper right. And you'll
be ready to use it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range
Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteValues
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub

"wally" wrote:

I am a novice about the procedure you are telling me about. I am not
sure exactly what I am supposed to do. Are you saying I would double
click on a cell, i.e., D6, or d7 or d8, etc and it would copy and paste
the row of numbers to cell d59?. A double click sounds like a viable
solution. But, how do I get this into the macro mode? I looked at the
web site referenced but it is way over my head even to begin with.
Thanks,
JLatham (removethis) wrote:
Not knowing where to start or how to tell which week is which, how about a
routine that will copy one of the rows when you double-click on a cell in
column D (in the rows from 6-35)?

This needs to go into the sheet's event code for _BeforeDoubleClick()
for help in getting it in there, if you need it:
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range

Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteAll
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True

End Sub

"wally" wrote:

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb






  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default cut and paste macro

Hi,
taking this same example, how about a macro to paste the data to the
corresponding row in col "o", instead of to c59?
thanks

"JLatham" wrote:

Glad to hear it. Thanks. Just be aware that sometimes, if you're slow on
the double-click, Excel won't see it as a double-click, just as 2 clicks.

"wally" wrote:

Works great!! Thanks for your prompt and informative reply.
Wally
JLatham (removethis) wrote:
Wally,
Exactly right - double-click in any cell from D6 to D36 and all the
information on that row from D on out to where ever it ends will be copied
down to C59. What is at C59 will be overwritten.

Here is the easy way to insert the code:
Go to the sheet where your information is at.
Right-Click on the sheet tab (right on the name) and a list will come up,
choose [View Code] from the list. The Visual Basic Editor will open up and
show you a pretty much blank white page.
Cut and paste the code below right in to it. Don't copy from the earlier
post of mine, the first line will cause an error, I've rewritten that line
here so that the run over into a second line won't cause you any problem.

Then just close the VB Editor like any window- X at upper right. And you'll
be ready to use it.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range
Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteValues
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub

"wally" wrote:

I am a novice about the procedure you are telling me about. I am not
sure exactly what I am supposed to do. Are you saying I would double
click on a cell, i.e., D6, or d7 or d8, etc and it would copy and paste
the row of numbers to cell d59?. A double click sounds like a viable
solution. But, how do I get this into the macro mode? I looked at the
web site referenced but it is way over my head even to begin with.
Thanks,
JLatham (removethis) wrote:
Not knowing where to start or how to tell which week is which, how about a
routine that will copy one of the rows when you double-click on a cell in
column D (in the rows from 6-35)?

This needs to go into the sheet's event code for _BeforeDoubleClick()
for help in getting it in there, if you need it:
http://www.jlathamsite.com/Teach/WorksheetCode.htm

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
'a double-click in column D from row 6 to row 35 will activate this
Dim anyRange As Range

Set anyRange = Intersect(Target, Range("D6:D36"))
If anyRange Is Nothing Then
Exit Sub
End If
Cancel = True
Application.EnableEvents = False
Range(anyRange.Address & ":M" & anyRange.Row).Copy
Range("C59").PasteSpecial xlPasteAll
Target.Select
Application.CutCopyMode = False
Application.EnableEvents = True

End Sub

"wally" wrote:

I have 30 rows of numbers the range is: d6:g35, j6:m35 (with h6:i35
blank). Each week I copy and paste one row of numbers to c59. Can you
provide a macro that will copy and paste the one row only for one week.
Then, when I run the macro again the next week it will copy the next
row down and paste it to cell c59. Thanks.
Wallyb






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



All times are GMT +1. The time now is 03:10 PM.

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"