I Have this code which works well however I am needing to expand this box set up to 4 different ones. This is listing out livestock and would be adding/pulling info from same sheet but different stock in each in each range.
So for example first box set may have “stock 224” and second box set may have “stock 225”
'On Livestock Change
If Not Intersect(Target, Range("E19")) Is Nothing Then
Dim Stockrow As Long
If Range("E19").Value <> Empty Then
If Range("B8").Value = Empty Then 'Not Existing livestock
If MsgBox("The customer is not currently in the Livestock list. Would you like to add it?", vbYesNo, "Customer Not Found") = vbNo Then Exit Sub
'Launch userform to add livestock
Else 'Existing Customer Found
Livestockrow = Range("B8").Value ' Livestock Row
Range("L19:M19").Value = Livestock_List.Range("C" & Livestockrow).Value 'DOB
Range("E20:I20").Value = Livestock_List.Range("D" & Livestockrow).Value 'breed
Range("L20:M20").Value = Livestock_List.Range("E" & Livestockrow).Value 'EID
Range("E21:F21").Value = Livestock_List.Range("F" & Livestockrow).Value 'Registered
Range("I21").Value = Livestock_List.Range("G" & Livestockrow).Value 'Registrration
Range("L21:M21").Value = Livestock_List.Range("H" & Livestockrow).Value 'Registrration Number
Range("E22:I22").Value = Livestock_List.Range("I" & Livestockrow).Value 'SIRE
Range("L22:M22").Value = Livestock_List.Range("J" & Livestockrow).Value 'Sire Registrration Number
Range("E23:I23").Value = Livestock_List.Range("K" & Livestockrow).Value 'Dam
Range("L23:M23").Value = Livestock_List.Range("L" & Livestockrow).Value 'Dam Registrration
End If
Else 'Is Empty
Range("L19:M19").ClearContents 'Clear DOB
Range("E20:I20").ClearContents 'Clear breed
Range("L20:M20").ClearContents 'Clear EID
Range("E21:F21").ClearContents 'ClearRegistered
Range("I21").ClearContents 'Clear Registrration
Range("L21:M21").ClearContents 'Clear Registrration Number
Range("E22:I22").ClearContents 'Clear'SIRE
Range("L22:M22").ClearContents 'Clear Sire Registrration Number
Range("E23:I23").ClearContents 'Clear Dam
Range("L23:M23").ClearContents 'Clear Dam Registrration
End If
I attached an image to show box sets. Any assistance is appreciated
I tried repeating code which didn’t work but i am not code savvy
PHILLIPS FAMILY is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.