LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Len Len is offline
external usenet poster
 
Posts: 162
Default Copy Dynamic Range problem

Hi

I am copying a dynamic range of cells from 12 different worksheets
under workbook A.
I need to select an adjacent range that starts with "OP" ( always at
column A ) on every sheet ( 12 ) and copy
that adjacent range of data without the formula to another workbook B
in each of 12 worksheets
at the next 5 rows of last used cells of column E
E.g. if there is "OP" in the mid of column A, select the current
region starts from column B to O
in sheet "ADP" ( out of 12 sheets ) under workbook A and copy (without
the formula ) paste to sheet"ADP" ( out of 12 sheets ) under workbook
B
at the next 5 rows of last used cells of column E

Below is the extract of draft excel vba code for a single sheet seems
to be incomplete as it copies row by row and does not work as
intended, further I have no idea how to design excel vba for multiple
sheets

Dim wsNew As Worksheet
Dim OpWs As Worksheet
Dim sTarget As String
Dim i As Integer

Sheets.Add Befo=Sheets(1)
Set OpWs = ActiveSheet

Workbooks.Open Filename:="C:\Budget Final\Acad\ADP.xls"
Windows("ADP.xls").Activate
Set wsNew = Sheets("P+L")
sTarget = "OP"
With Worksheets("P+L")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For i = 1 To iLastRow
If .Cells(i, "A").Value = sTarget Then
iNextRow = iNextRow + 1

.Rows(i).Copy OpWs.Cells(iNextRow, "A")
End If
Next i
End With

Appreciate any help to solve the above problem as I'm excel vba
beginner

Many thanks

Warm regards
Len

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic copy range LiAD Excel Programming 12 September 2nd 09 09:36 AM
dynamic charts - problem with copy maggym Charts and Charting in Excel 3 August 2nd 09 09:22 PM
Copy dynamic range Sandy Excel Programming 3 April 18th 08 08:14 PM
Dynamic range copy. sungen99[_22_] Excel Programming 1 June 10th 05 04:44 PM
Dynamic range problem #2 rudolpsh[_3_] Excel Programming 0 January 23rd 04 09:03 AM


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"