Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate,Copy, Paste Cell Group Macro Adjustments
Tom Ogilvy was so kind to help me with the below macro which works
great for copy and paste 5 number workbook but having a problem applying it to 6 number and 4 number workbook I was hoping to make changes to the macro so i could use it to copy and paste in workbooks with 6 numbers and another workbook with 4 numbers so it would run the same way but for some reason it will not work. here are the changes i made to Tom's macro thinking it would run in the 6 number workbook but does not run Dim cell As Range, n As Long, v(1 To ""6"") As String v(4) = "AI": v(5) = "AJ" "": v(6) = "AK" "" could you please tell me what i am missing to make it run....thanks Here is Toms macro that works fine with 5 number workbook Sub afpaste() Dim rng As Range, i As Long, j As Long Dim cell As Range, n As Long, v(1 To 5) As String Dim s As Long s = Application.Calculation Application.Calculation = xlManual n = 25 Set rng = Range("AF78:AJ78") v(1) = "AF": v(2) = "AG": v(3) = "AH" v(4) = "AI": v(5) = "AJ" For i = 1 To n Application.Calculate j = 0 For Each cell In rng j = j + 1 Cells(i + 80, v(j)).Value = cell.Value Next Next Application.Calculation = s End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate,Copy, Paste Cell Group Macro Adjustments
Hi,
I guessing.... Sub afpaste4() Dim rng As Range, i As Long, j As Long Dim cell As Range, n As Long, v(1 To 4) As String Dim s As Long s = Application.Calculation Application.Calculation = xlManual n = 25 Set rng = Range("AF78:AI78") v(1) = "AF": v(2) = "AG": v(3) = "AH" v(4) = "AI" For i = 1 To n Application.Calculate j = 0 For Each cell In rng j = j + 1 Cells(i + 80, v(j)).Value = cell.Value Next Next Application.Calculation = s End Sub for 4 number workbook, and... Sub afpaste6() Dim rng As Range, i As Long, j As Long Dim cell As Range, n As Long, v(1 To 6) As String Dim s As Long s = Application.Calculation Application.Calculation = xlManual n = 25 Set rng = Range("AF78:AK78") v(1) = "AF": v(2) = "AG": v(3) = "AH" v(4) = "AI": v(5) = "AJ": v(6) = "AK" For i = 1 To n Application.Calculate j = 0 For Each cell In rng j = j + 1 Cells(i + 80, v(j)).Value = cell.Value Next Next Application.Calculation = s End Sub for 6 number workbook. Ken Johnson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate,Copy, Paste Cell Group Macro Adjustments
Sub afpaste6()
Dim rng As Range, i As Long, j As Long Dim cell As Range, n As Long, v(1 To 6) As String Dim s As Long s = Application.Calculation Application.Calculation = xlManual n = 25 Set rng = Range("AF78:AK78") v(1) = "AF": v(2) = "AG": v(3) = "AH" v(4) = "AI": v(5) = "AJ" : v(6) = "AK" For i = 1 To n Application.Calculate j = 0 For Each cell In rng j = j + 1 Cells(i + 80, v(j)).Value = cell.Value Next Next Application.Calculation = s End Sub ------------ Sub afpaste4() Dim rng As Range, i As Long, j As Long Dim cell As Range, n As Long, v(1 To 4) As String Dim s As Long s = Application.Calculation Application.Calculation = xlManual n = 25 Set rng = Range("AF78:AI78") v(1) = "AF": v(2) = "AG": v(3) = "AH" v(4) = "AI" For i = 1 To n Application.Calculate j = 0 For Each cell In rng j = j + 1 Cells(i + 80, v(j)).Value = cell.Value Next Next Application.Calculation = s End Sub -- Regards, Tom Ogilvy wrote in message oups.com... Tom Ogilvy was so kind to help me with the below macro which works great for copy and paste 5 number workbook but having a problem applying it to 6 number and 4 number workbook I was hoping to make changes to the macro so i could use it to copy and paste in workbooks with 6 numbers and another workbook with 4 numbers so it would run the same way but for some reason it will not work. here are the changes i made to Tom's macro thinking it would run in the 6 number workbook but does not run Dim cell As Range, n As Long, v(1 To ""6"") As String v(4) = "AI": v(5) = "AJ" "": v(6) = "AK" "" could you please tell me what i am missing to make it run....thanks Here is Toms macro that works fine with 5 number workbook Sub afpaste() Dim rng As Range, i As Long, j As Long Dim cell As Range, n As Long, v(1 To 5) As String Dim s As Long s = Application.Calculation Application.Calculation = xlManual n = 25 Set rng = Range("AF78:AJ78") v(1) = "AF": v(2) = "AG": v(3) = "AH" v(4) = "AI": v(5) = "AJ" For i = 1 To n Application.Calculate j = 0 For Each cell In rng j = j + 1 Cells(i + 80, v(j)).Value = cell.Value Next Next Application.Calculation = s End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy paste cell with value using macro | Excel Discussion (Misc queries) | |||
Want to use a Macro to copy and paste cell *value* only | Excel Discussion (Misc queries) | |||
Calculate,Copy, Paste Cell Group | Excel Programming | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming | |||
vba to sort group copy paste to another sheet | Excel Worksheet Functions |