I will try and explain as best as I can..
Basically, the company I work for needs a way to copy the data from a worksheet and paste it into a job card...
At the moment, I have only managed to be able to write the VB so it creates one job card at a time (see below)
[/URL][/IMG]
Using the below userform, the listbox pulls the rows of data from a worksheet.
Is there some sort of Loop where Excel will loop through all rows, copy the relevant data into the job card, and then add a new sheet into a workbook with each individual job card copied.
Hope that makes sense.
Any help appreciated.
Basically, the company I work for needs a way to copy the data from a worksheet and paste it into a job card...
At the moment, I have only managed to be able to write the VB so it creates one job card at a time (see below)
Code:
Sub CreateJobCard()
'Generates job card
wsJob.Range("C2").Value = wsData.Cells(frmMain.lstViewInc.ListIndex + 5, 3)
wsJob.Range("K2").Value = wsData.Cells(frmMain.lstViewInc.ListIndex + 5, 4)
wsJob.Range("A6").Value = wsData.Cells(frmMain.lstViewInc.ListIndex + 5, 2)
wsJob.Range("B6").Value = wsData.Cells(frmMain.lstViewInc.ListIndex + 5, 10)
wsJob.Range("B10").Value = wsData.Cells(frmMain.lstViewInc.ListIndex + 5, 11)
wsJob.Copy
With Application.FileDialog(msoFileDialogSaveAs)
If .show = -1 Then
.Execute
Else
Exit Sub:
End If
End With
ActiveWorkbook.Close
End Sub
![Job%20Card_zps3kstfxy8.png](/board/proxy.php?image=http%3A%2F%2F%5BURL%3D%22https%3A%2F%2Fs610.photobucket.com%2Fuser%2Fexordiumx%2Fmedia%2FJob%2520Card_zps3kstfxy8.png.html%22%5D%5BIMG%5Dhttps%3A%2F%2Fi610.photobucket.com%2Falbums%2Ftt185%2Fexordiumx%2FJob%2520Card_zps3kstfxy8.png&hash=4653e4343ae4dc6405415de27a155f3f)
Using the below userform, the listbox pulls the rows of data from a worksheet.
![View%20Incidents_zpsauxoybi9.png](/board/proxy.php?image=https%3A%2F%2Fi610.photobucket.com%2Falbums%2Ftt185%2Fexordiumx%2FView%2520Incidents_zpsauxoybi9.png&hash=a3844941ebe07517b6c0d20c2a8ee044)
Is there some sort of Loop where Excel will loop through all rows, copy the relevant data into the job card, and then add a new sheet into a workbook with each individual job card copied.
Hope that makes sense.
Any help appreciated.