ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   whats wrong with this code (https://www.excelbanter.com/excel-programming/309364-whats-wrong-code.html)

LiSa

whats wrong with this code
 
Hi
Cany anyone tell me what's wrong with the code below.
I get an application defined or object defined error



With ActiveWorkbook.Sheets(1)
.Range(d9) = ThisWorkbook.Sheets(1).Range(b3)
.Range("h6") = ThisWorkbook.Sheets(1).Range("b16")
.Range("h7") = ThisWorkbook.Sheets(1).Range("d16")
.Range("h8") = ThisWorkbook.Sheets(1).Range("g16")
End With

JulieD

whats wrong with this code
 
Hi Lisa

at a glance

.Range(d9) = ThisWorkbook.Sheets(1).Range(b3)
should be
.Range("d9") = ThisWorkbook.Sheets(1).Range("b3")

Cheers
JulieD

"LiSa" wrote in message
...
Hi
Cany anyone tell me what's wrong with the code below.
I get an application defined or object defined error



With ActiveWorkbook.Sheets(1)
.Range(d9) = ThisWorkbook.Sheets(1).Range(b3)
.Range("h6") = ThisWorkbook.Sheets(1).Range("b16")
.Range("h7") = ThisWorkbook.Sheets(1).Range("d16")
.Range("h8") = ThisWorkbook.Sheets(1).Range("g16")
End With




LiSa

Doh
 
I'd missed out the "" - how embarrassing.

Thanks for the help with the previous query guys
-----Original Message-----
Hi
Cany anyone tell me what's wrong with the code below.
I get an application defined or object defined error



With ActiveWorkbook.Sheets(1)
.Range(d9) = ThisWorkbook.Sheets(1).Range(b3)
.Range("h6") = ThisWorkbook.Sheets(1).Range("b16")
.Range("h7") = ThisWorkbook.Sheets(1).Range("d16")
.Range("h8") = ThisWorkbook.Sheets(1).Range("g16")
End With
.



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com