copy paste different ranges

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

Hi
I have the 20 following ranges that has formulas and I need to copy them to
another work book at the same location.
The ranges are:
H9:H12
H44:H47
H84:H87
H124:H127
H164:H167
H204:H207
H244:H247
H284:H287
H324:H327
H364:H367
H404:H407
H444:H447
H484:H487
H524:H527
H564:H567
H604:H607
H644:H647
H684:H687
H724:H727
H764:H767

I have selected theses ranges and used copy and paste special (with formula
only) but it copy them in the new work book one after the other starting at
H9 until the last cell in H88

Is there a way to solve this (VBA Code, Macro!!!) or I have to do it each
range seperatly?
Note: these formulas has to be copy to 25 diferent books.
 
After the first range H9:H12, the rest are laid out nicely.

This may work for you:

Option Explicit
Sub testme()

Dim FromWks As Worksheet
Dim ToWks As Worksheet
Dim iRow As Long

Set FromWks = Workbooks("book1.xls").Worksheets("Sheet1")
Set ToWks = Workbooks("book2.xls").Worksheets("sheet1")

FromWks.Range("H9:H12").Copy
ToWks.Range("H9").PasteSpecial Paste:=xlPasteFormulas

For iRow = 44 To 764 Step 40
FromWks.Cells(iRow, "H").Resize(4, 1).Copy
ToWks.Cells(iRow, "H").PasteSpecial Paste:=xlPasteFormulas
Next iRow

End Sub
 
Hi Dave,
I beleive in organaized work since it makes it easy when having problems.
It worked fine with me But I forgot the password for the VBA code so I had
to open a new workbook to use the code.
Do you have a way to get the password. I may eamil the file for you.
Tell me on my email address of khhandal AT yahoo.com

Thanks again
 
Nope. I don't have a password breaker.

Khalil said:
Hi Dave,
I beleive in organaized work since it makes it easy when having problems.
It worked fine with me But I forgot the password for the VBA code so I had
to open a new workbook to use the code.
Do you have a way to get the password. I may eamil the file for you.
Tell me on my email address of khhandal AT yahoo.com

Thanks again
 
Back
Top