Hello,
I have been working on this "database" program for a couple of days, but just cannot get one thing and would greatly appreciate some help
I have a fill form which is created every time a new sample is added and information gets inserted into their respective columns
V W X Y Z AA AB AC AD AE AF
ID Mouse Passage Virtualtag Date Box RNA Cryo Snap Mice Box Notes
What I want is for a value to read changes in values that is written into columns AA:AE which represent the amount of times to duplicate the row from V:Z and AF be copied and inserted below from left to right and for the number that defines the amount of times the row will be replicated to become a string (category title)
An example would be:
V W X Y Z AA AB AC AD AE AF AG
ID Mouse Passage Virtualtag Date Box RNA Cryo Snap Mice Box NotesCategory
xX yy zz aa bb 2 3 3 2 1 asdf
and the result to be:
V W X Y Z AA AB AC AD AE AF AG
ID Mouse Passage Virtualtag Date Box RNA Cryo Snap Mice Box NotesCategory
xX yy zz aa bb 2 asdf RNA
xX yy zz aa bb 1 asdf RNA
xX yy zz aa bb 3 asdf Cryo
xX yy zz aa bb 2 asdf Cryo
xX yy zz aa bb 1 asdf Cryo
xX yy zz aa bb 3 asdf Snap
xX yy zz aa bb 2 asdf Snap
xX yy zz aa bb 1 asdf Snap
xX yy zz aa bb 2 asdf Mice
xX yy zz aa bb 1 asdf Mice
xX yy zz aa bb 1 asdf Box
The database has other aspects to it that I have amde functional such as "search" and "fill form" but I can seem to get this.. first program ever created and can’t get over this obstacle
Here is my code so far:
Thank you so much!
I have been working on this "database" program for a couple of days, but just cannot get one thing and would greatly appreciate some help
I have a fill form which is created every time a new sample is added and information gets inserted into their respective columns
V W X Y Z AA AB AC AD AE AF
ID Mouse Passage Virtualtag Date Box RNA Cryo Snap Mice Box Notes
What I want is for a value to read changes in values that is written into columns AA:AE which represent the amount of times to duplicate the row from V:Z and AF be copied and inserted below from left to right and for the number that defines the amount of times the row will be replicated to become a string (category title)
An example would be:
V W X Y Z AA AB AC AD AE AF AG
ID Mouse Passage Virtualtag Date Box RNA Cryo Snap Mice Box NotesCategory
xX yy zz aa bb 2 3 3 2 1 asdf
and the result to be:
V W X Y Z AA AB AC AD AE AF AG
ID Mouse Passage Virtualtag Date Box RNA Cryo Snap Mice Box NotesCategory
xX yy zz aa bb 2 asdf RNA
xX yy zz aa bb 1 asdf RNA
xX yy zz aa bb 3 asdf Cryo
xX yy zz aa bb 2 asdf Cryo
xX yy zz aa bb 1 asdf Cryo
xX yy zz aa bb 3 asdf Snap
xX yy zz aa bb 2 asdf Snap
xX yy zz aa bb 1 asdf Snap
xX yy zz aa bb 2 asdf Mice
xX yy zz aa bb 1 asdf Mice
xX yy zz aa bb 1 asdf Box
The database has other aspects to it that I have amde functional such as "search" and "fill form" but I can seem to get this.. first program ever created and can’t get over this obstacle

Here is my code so far:
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Integer
If Intersect(Target, Range("AA:AE")) Is Nothing Then Exit Sub
If IsNumeric(Target.Value) = False Then Exit Sub
If Target.Value = 0 Then Exit Sub
If Target.Value = vbNullString Then Exit Sub
x = Target.Value
Do
Range(Cells(Target.Row, "V"), Cells(Target.Row, "Z")).Copy
Range(Cells(Target.Row + 1, "V"), Cells(Target.Row + 1, "Z")).Insert Shift:=xlDown
x = x - 1
Loop Until x = 1
Application.CutCopyMode = False
End Sub
Thank you so much!