ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy specific cells in workbook to new workbook (https://www.excelbanter.com/excel-programming/375608-copy-specific-cells-workbook-new-workbook.html)

ploddinggaltn

copy specific cells in workbook to new workbook
 
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



Tom Ogilvy

copy specific cells in workbook to new workbook
 

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

--
Regards,
Tom Ogilvy

"ploddinggaltn" wrote:

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




All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com