Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy paste cell with value using macro ramzi Excel Discussion (Misc queries) 0 August 15th 08 04:38 AM
Want to use a Macro to copy and paste cell *value* only HeadRusch Excel Discussion (Misc queries) 1 May 11th 07 11:06 PM
Calculate,Copy, Paste Cell Group [email protected] Excel Programming 7 February 24th 06 01:32 AM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
vba to sort group copy paste to another sheet mango Excel Worksheet Functions 0 November 5th 04 04:27 AM


All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"