Copy on change of value
Taking your request literally. ANY change in column A will result in the
action - even new additions at the bottom of the existing list. To put this
code into use, right click on the Budget sheet's tab and choose View Code,
cut and paste this into it.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim DestRange As Range
Dim Offset1 As Long
Dim Offset2 As Long
Dim LC As Integer
If Target.Column < 1 Then
Exit Sub
End If
Application.EnableEvents = False
Set DestRange = Worksheets("Data").Range("A1")
If IsEmpty(DestRange) Then
Offset2 = 0
Else
Offset2 = Worksheets("Data").Range("A" & Rows.Count).End(xlUp).Row
End If
Offset1 = 0
Do While Not (IsEmpty(Target.Offset(Offset1, 0)))
For LC = 1 To 12
DestRange.Offset(Offset2, 0) = Target.Offset(Offset1, 0)
Offset2 = Offset2 + 1
Next
Offset1 = Offset1 + 1
Loop
Application.EnableEvents = True
End Sub
"Jim G" wrote:
I have a list of unique accounts in column A on a worksheet "Budget".
I wish to copy each account number from the worksheet "Budget" to another
worksheet called "Data" over 12 rows in column A then when the value changes
copy the next value down the next 12 rows and so on until the next value is
blank or empty.
The result would be the list of accounts in Col A of "Budget" are repeated
12 times each in Column A of worksheet "Data".
Any help would be much appreciated.
--
Jim
|