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: 28
Default Trouble changing Range destination

Hello,
I'm using code to save a Range in the BeforeSave event of a closed workbook:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheet2.Range("B3:I3") = Sheet1.UsedRange.Address
End Sub

I'm then using code in a module in another workbook to retrieve that Range:

Sub PullInSheet1()
'Pulls in Range data from sheet1 of a closed workbook.
Dim AreaAddress As String
'Refrence the UsedRange Address of Sheet1 in the closed workbook.
Sheet2.Range("B3:I3") = "= 'C:\" & "[CTest.xls]Sheet1'!RC"

'Pass the area Address to a String.
AreaAddress = Sheet2.Range("B3:I3").Address

With Sheet2.Range(AreaAddress)
'If the cell in Sheet1 of the closed workbook is not empty _
'then pull in it's content, else put in an Error.

.FormulaR1C1 = "=If('C:\" & "[CTest.xls]Sheet1'!RC ="""",NA(),'C:\"
& "[CTest.xls]Sheet1'!RC)"

'Delete all Error cells
On Error Resume Next
.SpecialCells(xlCellTypeFormulas, xlErrors).Clear
On Error GoTo 0
'Change all formulas to Values only.
.Value = .Value
End With

End Sub

The Range is pulled into Sheet2 ("B3:I3"), I'd like to change the
destination in Sheet2 to ("B8:I8") and I'm having trouble doing that.
Thanks in advance for any help.
Paul
 
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
Range.Copy [Destination] should not use clipboard Ming[_2_] Excel Discussion (Misc queries) 0 October 1st 09 11:13 PM
Destination Range Names to be deleted. Guru Vikram Excel Programming 6 July 30th 06 06:39 AM
Destination range marpetban Excel Discussion (Misc queries) 0 July 5th 06 02:51 PM
Selection.Autofill Destination:=Range(ActiveCell.Value) [email protected] Excel Programming 6 April 23rd 06 11:15 PM
Range.Copy (Destination) Garry Douglas Excel Programming 3 January 3rd 05 03:02 PM


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