VBA to Copy and Paste

rspalding

Active Member
Joined
Sep 4, 2009
Messages
282
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have 9 cells that have copy in them AE8 thru AE16 and 9 corresponding cells that indicate how many time to repeat that copy AC8 thru AC16. The maximum number of cells to paste into is 9 so AC8 could say 5 and AC9 could say 4 for a total of 9. Likewise AC8 thru AC16 could each have a qty of 1 for a total of 9 or any other combination for a total of 9. The corresponding cells to paste into F11, F22, F33, M11, M22, M33, T11, T22 and T33 in that order.

Than you,
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
try the following c codes
Code:
Sub rspalding()
Dim a As Long, b As Long, c As Long, e As Long
Dim d As String
a = Application.WorksheetFunction.Sum(Range("AC8:AC16"))
    If a <> 9 Then
    MsgBox "cells not totalling 9"
    Exit Sub
    End If
        For b = 1 To 9
        c = Cells(b + 7, "AC")
        d = Choose(b, "F11", "F22", "F33", "M11", "M22", "M33", "T11", "T22", "T33")
            For e = 1 To c
            Range(d) = Cells(b + 7, "AE")
            MsgBox d
            Next e
        Next b
MsgBox "complete"
End Sub
ravi shankar
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,303
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top