Code to Move information from one sheet to another

G

Guest

I have designed a significantly complex application to record certain results from one of our corporate areas.

This area is comprised of 3 "Divisions", and approximately 45 departments and 30 managers. A manager is responsible for any number of deparments, from 1 to 3. Each Division, Department, or Manager is identified by a number.

I am importing data from financial records into a data file. I have a number of tabs and functions that manipulate the data into critical pieces of information, statistics, ratios, etc.

I have set up one sheet that acts as a report, so that when I input (manually or macro) any valid manager or department number, the report is populated with the critical information from that particular department, manager (in total), or division (in total).

I have written a macro that will input every valid "number" into the key cell of the report, then print the page.
This all works fairly well.

I would like to do a macro, however, will print each, but before printing, insert specific cells from the report into an execitove summary report.

Thus 1. moving approximately 12 cells (value only) to the executive summary on a line,

2. Printing the report for that individual number, then

3. replacing the "number" with the next valid number, copying the same 8 cells into the NEXT line of the exec summary, printing...and looping through that process untill each valid number is processed, ending the macro.

My valid number list is situated on a tab entitled "DeptControl" and is approximately 80 rows, all in colum C. The report tab is entitled "info". The executive summary tab is entitled "exec summ".

Can this be handled with a macro rather simply? I can key the results printed on each page, but would be keying 12 cells from each, to approximately 80 lines, or 960 characters. The result would be faster and much more accurate if automated.
 
D

Debra Dalgleish

Add code to find the first blank row on the Exec worksheet, and paste
the copied data there. For example:

'=================
Dim c As Range
Dim r As Long
Dim wsI As Worksheet
Dim wsE As Worksheet
Set wsI = Worksheets("Info")
Set wsE = Worksheets("Exec Summ")

For Each c In Range("ItemList")
'your code here, to enter next valid number,
' and extract data to wsI

r = wsE.Cells(Rows.Count, 1).End(xlUp).Row + 1
wsI.Range(wsI.Cells(2, 1), wsI.Cells(2, 8)).Copy _
Destination:=wsE.Cells(r, 1)
Next c
'========================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top