hdbkiwi

New Member
Joined
Sep 22, 2014
Messages
10
Dear all,

First off, thank you in advance to anyone who posts an answer to this question - I really appreciate your help!

I am using Excel 2010 to try and make a macro that will try and automate a rather tiresome process of creating many excel workbooks with certain information extracted from a master excel workbook.

I have so far managed to successfully extract information into another section of the same workbook, but would like to copy this information into specific cells in a new template workbook. I am getting stuck on the copying step. Could anyone advise on the best way to copy information to a new workbook and what I'm doing wrong?

Your time would be very much appreciated - thank you so much!

Private Sub CommandButton2_Click()
Dim FName As String
Dim FPath As String




Dim k As Integer
k = 1
For k = 1 To 1000
(cycling through all of the different names to save the workbook as)
FPath = "C:\Users\hdbkiwi\Documents\"
FName = Cells(k, 21).Value
Workbooks.Add ("C:\Users\hdbkiwi\Documents\FormBTemplate.xlsx")
ActiveWorkbook.Sheets("CRC Form B+").Range("G2").Value = Application.Workbooks("Source List for Form B's - Fiddling").Worksheets(1).Cells(1, 1).Value
(This is the problem here - the workbook is not copying anything into the new workbook (from Source List to CRC Form B+) - ideally I'd like to cycle along using k to copy row 1 into new workbook 1, (as well as an index match step that I'd also need to copy in but havent got there yet) and save using the 21st column as the file name of the workbook)

ActiveWorkbook.SaveAs Filename:=FPath & FName
ActiveWorkbook.Close


Next k


End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,216,075
Messages
6,128,667
Members
449,462
Latest member
Chislobog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top