copy specific cells in workbook to new workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 reports that I want to summerize into one. If I get help some basic
help, I should be able to create the summary. I need to copy about 10 rows
from each report into the recap and need to call them individually I believe.
For example

For the workbook "GESS CC", I want to take the data in col b where col A
states, "Total MC Payments" and move it to Row 6, Col B in workbook titled,
"Recap". I also want to take the data in that same workbook from col b where
col A states, Total MC Payment Amount" and move it to Row 7, Col B in the
Recap workbook.

Those are 2 cells I want to move and I have about 28 more to go but if
somebody can help me with these, I should be OK to figure out the rest.
Thanks
 
Sub ProcessData()
Dim sh as worksheet, sh1 as Worksheet
Dim bk as Workbook, bk1 as Workbook
Dim v as Variant, v1 as Variant
Dim s as String
Dim rng1 as Range, i as long
v = Array("Total MC Payments", _
"Total MC Payment Amount", _
. . . Additional . . . )

v1 = Array("B6","B7", . . . Additional . . .)

Set bk = Workbooks.Open("C:\MyFolder\Recap.xls")
Set sh = bk.Worksheets("Sheet1")
set bk1 = Workbooks.Open("C:\Myfolder\GESS CC.xls")
set sh1 = bk1.Worksheets("Sheet1")
for i = lbound(v) to ubound(v)
s = v(i)
Set rng1 = sh1.Columns(1).Find(What:=s, _
After:=sh1.Range("A65536"), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
sh.Range(v1(i)).Value = rng1.Value
end if
Next i

.. . .

end sub
 

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

Back
Top