I have now solved the problem (I'm on a roll today!!!).
I have two parts to creating the reference and this is the only way I can think of solving it. If someone else has any comments, I welcome them.
I have this in the cell in which the reference is to be held and indeed each cell in column K
="PJW/"&G5&"/"&LEFT(B5,2)&LEFT(C5,2)&Data!$K$7
I have this attached to a button marked 'create reference'
Sub CreateRef()
ActiveWorkbook.Save
Application.ScreenUpdating = False
Sheets("Data").Select
Range("K7").Select
Range("K7") = Int((9999 - 0 + 1) * Rnd + 9999)
Sheets("Live Files").Select
ActiveCell.Select
Selection.Copy
Sheets("Live Files").Select
ActiveCell.Select
Selection.PasteSpecial xlValues
Application.ScreenUpdating = True
End Sub
Because of the order everything happens a new random number is created each time and the random number is preserved once the copy and paste special is executed!
What is produced is PJW/GAFE/AZGr15794
PJW being the manager, GAFE the case handler, AZGr two letters from two relevant cells and then the random number.
I have to say I'm quite pleased with this!
Thank you to everyone that helped me and as I said any comments are welcome.
Bookmarks