Unable to set a range in one workbook to a range in another workbo

M

MichaelDavid

Greetings!

My attempts to set a range of BookIssuers.xlsm equal to a range of
BookDates.xlsm fail, with no diagnostic message. BookIssuers.xlsm is the
active sheet. Why the failure? Why no diagnostic message?

' Note: The 9 cells of BookDates Range("J162:R162") = 1|3 PanTerra
Resource 0.055 4720000 Rumak SkpdCOO Sparrow Ofc3Name Ofc4Name

CellAddrRow = 162

With Workbooks("BookDates.xlsm").Worksheets(1)
Range("F4") = .Range("J" & CellAddrRow & ":R" & CellAddrRow) ' This instr
is totally ignored, gives no diagnostic message and has no effect.

Workbooks("BookIssuers.xlsm").ActiveSheet.Range("F4") = .Range("J" &
CellAddrRow & ":R" & CellAddrRow) ' This instr is totally ignored, gives no
diagnostic message and has no effect.

.Range("J" & CellAddrRow & ":R" & CellAddrRow).Copy
ActiveSheet.Range("F4") ' This instr successfully sets the desired 9 cell
range in BookIssuers.xlsm
End With
--
May you have a most blessed day!

Sincerely,

Michael Fitzpatrick
 
B

Bernie Deitrick

Michael,

You need to use ranges of equal size (rows and columns):

Range("F4:N4").Value = Workbooks("BookDates.xlsm"). _
Worksheets(1).Range("J" & CellAddrRow & ":R" & CellAddrRow).Value

HTH,
Bernie
MS Excel MVP
 
M

MichaelDavid

Hi Bernie!
Your solution worked perfectly. Thanks a million.
--
May you have a most blessed day!

Sincerely,

Michael Fitzpatrick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top