Copy on change of value
Thanks for the response.
When I try to run the code it asks for a macro. Do I need to do anything
else?
I have several budget sheets to add to the data sheet I then import the lot
into our accounting software (12 mths x 100 accounts x 4 divisions). Will
this code run for each sheet separately and add to the data sheet? If the
import gets too cumbersome I will use separate import files for each division.
Cheers
--
Jim
"JLatham" wrote:
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
|