ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   out of range message (https://www.excelbanter.com/excel-programming/403513-out-range-message.html)

Souris

out of range message
 
I get message box from the msgbox, but I get out of range fwhen I assign the
range to my DestSheetRange. Any suggestions?

Your help is great appreciated,

Here is my code,

Response = MsgBox(Application.ActiveSheet.Range("B11").Value, vbOKOnly)

Dim DestSheetRange As Range


DestSheetRange = Sheets("sheet1").Range("B11")

Bob Phillips

out of range message
 

Set DestSheetRange = Sheets("sheet1").Range("B11")

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Souris" wrote in message
...
I get message box from the msgbox, but I get out of range fwhen I assign
the
range to my DestSheetRange. Any suggestions?

Your help is great appreciated,

Here is my code,

Response = MsgBox(Application.ActiveSheet.Range("B11").Value, vbOKOnly)

Dim DestSheetRange As Range


DestSheetRange = Sheets("sheet1").Range("B11")




Dave Peterson

out of range message
 
Check your spelling of that worksheet name--I don't think "Sheet1" exists in the
active workbook.

and remember you'll need to use the Set statement when you're working with
objects (like Ranges):

dim DestSheetRange as Range
Set DestSheetRange = Sheets("SpelledCorrectly").range("B11")



Souris wrote:

I get message box from the msgbox, but I get out of range fwhen I assign the
range to my DestSheetRange. Any suggestions?

Your help is great appreciated,

Here is my code,

Response = MsgBox(Application.ActiveSheet.Range("B11").Value, vbOKOnly)

Dim DestSheetRange As Range


DestSheetRange = Sheets("sheet1").Range("B11")


--

Dave Peterson

Souris

out of range message
 
Thanks for message,

"Dave Peterson" wrote:

Check your spelling of that worksheet name--I don't think "Sheet1" exists in the
active workbook.

and remember you'll need to use the Set statement when you're working with
objects (like Ranges):

dim DestSheetRange as Range
Set DestSheetRange = Sheets("SpelledCorrectly").range("B11")



Souris wrote:

I get message box from the msgbox, but I get out of range fwhen I assign the
range to my DestSheetRange. Any suggestions?

Your help is great appreciated,

Here is my code,

Response = MsgBox(Application.ActiveSheet.Range("B11").Value, vbOKOnly)

Dim DestSheetRange As Range


DestSheetRange = Sheets("sheet1").Range("B11")


--

Dave Peterson



All times are GMT +1. The time now is 08:49 AM.

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