I have a form in XL that reads data from 200 cases and displays them
one at a time(on one spreadsheet). I would like to be able to run a
macro that would run thru the case counter, read the data into the
form, copy the data, open a new workbook, and paste the case data on
sequentially numbered tabs.
I'm a newbie at this, but my attempt at this is below. It seems to
work up till the point where it is supposed to paste the data in the
new workbook. Any hits would be greatly appreciated. Thanks!
Sub XportQCReport()
Dim Wk As Workbook
Dim Wk2 As Workbook
Dim n As Integer
Dim y As Integer
Set Wk = ActiveWorkbook 'The orginal workbook with the case data
Set Wk2 = Workbooks.Add 'The destination workbook
Wk.Activate
Sheets("PDI_DataQC").Select
y = InputBox("How Many Cases (i.e. 1-200)?")
For n = 1 To y
Range("B1").Select
ActiveCell.FormulaR1C1 = n
Sheets("PDI_DataQC").Select
Cells.Select
Selection.Copy
Wk2.Activate
ActiveWorkbook.Worksheets.Add.Name = n
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Next n
End Sub