Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
HELP copy and paste
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.programming
|
|||
|
|||
HELP copy and paste
Please ONLY post in ONE place. See your other post
-- 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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Automating copy/paste/paste special when row references change | Excel Programming | |||
help w/ generic copy & paste/paste special routine | Excel Programming | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming |