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: 40
Default Working With Multiple Source and Destination Ranges

I am using excel 2003.

I have numerous ranges on 1 worksheet that I want to copy over to a new
workbook and worksheet. Is it possible to have multiple source ranges and
multiple destination ranges coded within a few lines of code? I am referring
to the lines in the code below of ,

"Set sourceRange = ..." and "Set destRange = DestSH ..."

I have coded a working macro to do this in numerous iterations to complete
the destination worksheet, but the macro is very long and code is duplicated
many times. I would like a simpler way to do this. I am new to all this
stuff and attempted something different (please hold the laughter).

Here is the part of the code I have attempted to which I receive "Run-time
error '13', Type mismatch":


Set sourceRange = ThisWorkbook.Sheets("Estimate").Range("B3:B7") &
Range("B20:B20") & Range("I5:I5") & Range("K4:K4")

'Sheet name of the destination, Invoice worksheet
Set DestSH = DestWB.Worksheets("Invoice")

DestWB.Activate

Set destRange = DestSH.Range("B3:B7") & DestSH.Range("B20:B20") &
DestSH.Range("I5:I5") & DestSH.Range("K4:K4")

With sourceRange
Set destRange = destRange.Resize(.Rows.Count, .Columns.Count)
End With
destRange.Value = sourceRange.Value '<== Write the new values to the
destination sheet


Suggestions?


 
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
Changing Pivot Table Data Source to multiple ranges Tom Garner Charts and Charting in Excel 1 December 24th 09 12:14 AM
Multiple "source" workbooks linked to single "destination" workboo DAVEJAY Excel Worksheet Functions 1 September 17th 07 05:33 PM
linking multiple books (source.xls) to a single book (destination. mday Excel Discussion (Misc queries) 4 August 25th 06 04:31 AM
copying and pasting from source sheet to destination sheet without naming source sht? Simon Lloyd[_753_] Excel Programming 5 June 2nd 06 06:11 PM
working with multiple ranges dreamz[_33_] Excel Programming 5 April 14th 06 09:20 PM


All times are GMT +1. The time now is 03:03 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"