Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to copy a range of cells and paste them after every Total
This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
selections aren't necessary. In fact, it would be easier to use
Datafilterautofilterfilter on the column for totalcopypaste to other sheet. Record a macro while doing and then clean up to remove the selections. Post back with your efforts for further assistance -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I am trying to copy a range of cells and paste them after every Total This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() OK. I see what you want. So I don't have to recreate If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I guess I don't understand your reasoning. I want to copy A3:G7 after every subtotal on same worksheet. -- Stacia "Don Guillett" wrote: selections aren't necessary. In fact, it would be easier to use Datafilterautofilterfilter on the column for totalcopypaste to other sheet. Record a macro while doing and then clean up to remove the selections. Post back with your efforts for further assistance -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I am trying to copy a range of cells and paste them after every Total This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia . |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
file sent
-- Stacia "Don Guillett" wrote: OK. I see what you want. So I don't have to recreate If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I guess I don't understand your reasoning. I want to copy A3:G7 after every subtotal on same worksheet. -- Stacia "Don Guillett" wrote: selections aren't necessary. In fact, it would be easier to use Datafilterautofilterfilter on the column for totalcopypaste to other sheet. Record a macro while doing and then clean up to remove the selections. Post back with your efforts for further assistance -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I am trying to copy a range of cells and paste them after every Total This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia . . |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Fantastic Don, don't know what I would have done without you. Thank you,
Thank you, Thank you. -- Stacia "Don Guillett" wrote: OK. I see what you want. So I don't have to recreate If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I guess I don't understand your reasoning. I want to copy A3:G7 after every subtotal on same worksheet. -- Stacia "Don Guillett" wrote: selections aren't necessary. In fact, it would be easier to use Datafilterautofilterfilter on the column for totalcopypaste to other sheet. Record a macro while doing and then clean up to remove the selections. Post back with your efforts for further assistance -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I am trying to copy a range of cells and paste them after every Total This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia . . |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub FindTotalSAS()
Call ClearHeadersSAS Dim lr As Long Dim c As Range Dim firstaddress With Worksheets(1) lr = .Cells(Rows.Count, 1).End(xlUp).Row With Range("a1:a" & lr) Set c = .Find("Total", LookIn:=xlValues, _ LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) If Not c Is Nothing Then firstaddress = c.Address Do If Left(c.End(xlDown), 5) = "Grand" Then Exit Sub Range("a5:g7").Copy Cells(c.Row + 1, 1) Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstaddress End If End With End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... Fantastic Don, don't know what I would have done without you. Thank you, Thank you, Thank you. -- Stacia "Don Guillett" wrote: OK. I see what you want. So I don't have to recreate If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I guess I don't understand your reasoning. I want to copy A3:G7 after every subtotal on same worksheet. -- Stacia "Don Guillett" wrote: selections aren't necessary. In fact, it would be easier to use Datafilterautofilterfilter on the column for totalcopypaste to other sheet. Record a macro while doing and then clean up to remove the selections. Post back with your efforts for further assistance -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I am trying to copy a range of cells and paste them after every Total This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia . . |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I don't understand your reasoning. I am trying to copy range A3:G7 after
every subtotal on the same page. -- Stacia "Don Guillett" wrote: selections aren't necessary. In fact, it would be easier to use Datafilterautofilterfilter on the column for totalcopypaste to other sheet. Record a macro while doing and then clean up to remove the selections. Post back with your efforts for further assistance -- Don Guillett Microsoft MVP Excel SalesAid Software "stacia" wrote in message ... I am trying to copy a range of cells and paste them after every Total This is what I have so far: Sub b8pastetitle() Dim theRange As Range Dim lastrow&, firstRow&, x& Set theRange = ActiveSheet.UsedRange lastrow = theRange.Cells(theRange.Cells.Count).Row firstRow = theRange.Cells(1).Row For x = lastrow To firstRow Step -1 If InStr(1, Cells(x, 1), "Total") 0 Then Range("A5 : G7").Select Selection.Copy ActiveSheet.Paste Destination:=Worksheets("Payroll").Cells(x + 2, 1).Selection.Paste End If Next End Sub -- Stacia . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Copy, paste without file name referenced after paste | Excel Discussion (Misc queries) | |||
Copy; Paste; Paste Special are disabled | Excel Discussion (Misc queries) | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
I cannot paste from one workbook to another. Copy works, paste do. | Excel Discussion (Misc queries) |