LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Efficient way to copy a range in numerous sheets within a workbook

Hello,

I am looking for info on creating a macro to take a range say C4:G56 in
(sheet 1) and copy that range to D4:H56 on the same sheet. I do this this
using paste special values because column C has formulas and I'm just
shifting data for the next month. The question I have is that I have many
sheets in a workbook that I do this process for and currently have a macro
that references each sheet and does a copy range and paste special. I would
like to make this long macro more efficient and also more manageable. I tried
grouping the sheets but had a problem with the paste special function. Also
not all sheets in the workbook need to be updated so grouping all of them
doens't work. Here is some of the code that I have come up with to this point
with no success. I'm hoping that all the variables I put in will help
identify what I'm trying to do. Any help will be greatly appreciated.

Dim wks As Worksheet
Dim DontCopy1 As Worksheet
Dim DontCopy2 As Worksheet
Dim DontCopy3 As Worksheet
Dim DontCopy4 As Worksheet
Dim CopyRange As Range
Dim DestCell As Range

Set CopyRange = Range("C4:G56")
Set DestCell = Range("D4")
Set DontCopy1 = Sheets("Instructions")
Set DontCopy2 = Sheets("Summary")
Set DontCopy3 = Sheets("Balances")
Set DontCopy4 = Sheets("DataSheet")

Sheets("Sheet1").Select
For Each wks In Worksheets
If wks.Name = DontCopy1.Name Then
If wks.Name = DontCopy2.Name Then
If wks.Name = DontCopy3.Name Then
If wks.Name = DontCopy4.Name Then
'do nothing
Else
ActiveSheet.Select
Range("C4:G56").Select
Selection.Copy
Range("D4").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1

End If
End If
End If
End If

Next wks

End Sub

Thank you in advance

Steve
 
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
how do i sum the same cell in numerous sheets behind a main njparamedic Excel Worksheet Functions 2 May 14th 09 02:27 PM
return same cell value from numerous sheets Laurie Excel Worksheet Functions 5 April 11th 08 02:19 PM
how to lookup in numerous different sheets Zak Excel Discussion (Misc queries) 6 January 11th 08 12:24 PM
Comparing numerous sheets Zak Excel Discussion (Misc queries) 5 January 10th 08 09:57 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM


All times are GMT +1. The time now is 03:13 AM.

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"