Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default VBA to select a defined range

Thanks in advance to all who help on this site.

I have the below code:


Public Sub MMR()

' Keyboard Shortcut: Ctrl+x

Dim DataSD As Worksheet
Dim MMR As Range
Set MMR = DataSD.Range("MMRrange")

MMR.Select

End Sub

When I Set MMR to = DataSD.Range("MMRrange") the MMRrange refers to a
defined range of cells on the DataSD worksheet. However, I have something
wrong for when I run this program this line gives an error?




--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default VBA to select a defined range

Try this without anything else to goto a range/cell named bill
However, it is rarely necessary to select to do something. More info?

Sub gothere()
Application.Goto "bill"
End Sub


--
Don Guillett
SalesAid Software

"Shawn" wrote in message
...
Thanks in advance to all who help on this site.

I have the below code:


Public Sub MMR()

' Keyboard Shortcut: Ctrl+x

Dim DataSD As Worksheet
Dim MMR As Range
Set MMR = DataSD.Range("MMRrange")

MMR.Select

End Sub

When I Set MMR to = DataSD.Range("MMRrange") the MMRrange refers to a
defined range of cells on the DataSD worksheet. However, I have something
wrong for when I run this program this line gives an error?




--
Thanks
Shawn



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default VBA to select a defined range

In your code you have declared DataSD as a Worksheet but you haven't set it
to anything before you use it. This causes an error.

Set DataSD = Worksheets("SheetNameContainingMMRange") 'This line is
missing
Set MMR = DataSD.Range("MMRrange") 'Needs
to know what DataSD is or you'll get an error

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"Shawn" wrote in message
...
Thanks in advance to all who help on this site.

I have the below code:


Public Sub MMR()

' Keyboard Shortcut: Ctrl+x

Dim DataSD As Worksheet
Dim MMR As Range
Set MMR = DataSD.Range("MMRrange")

MMR.Select

End Sub

When I Set MMR to = DataSD.Range("MMRrange") the MMRrange refers to a
defined range of cells on the DataSD worksheet. However, I have something
wrong for when I run this program this line gives an error?




--
Thanks
Shawn



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default VBA to select a defined range

I think you need to Set the DataSD object.

"Shawn" wrote in message
...
Thanks in advance to all who help on this site.

I have the below code:


Public Sub MMR()

' Keyboard Shortcut: Ctrl+x

Dim DataSD As Worksheet
Dim MMR As Range
Set MMR = DataSD.Range("MMRrange")

MMR.Select

End Sub

When I Set MMR to = DataSD.Range("MMRrange") the MMRrange refers to a
defined range of cells on the DataSD worksheet. However, I have something
wrong for when I run this program this line gives an error?




--
Thanks
Shawn



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default VBA to select a defined range

Neither DataSD nor MMR have been set to any objects.

In addition the syntax is

Set DataSD = Worksheets("Sheet1")
Set MMR = DataSD.Range("A1")

or so

--
HTH

Bob Phillips

"Shawn" wrote in message
...
Thanks in advance to all who help on this site.

I have the below code:


Public Sub MMR()

' Keyboard Shortcut: Ctrl+x

Dim DataSD As Worksheet
Dim MMR As Range
Set MMR = DataSD.Range("MMRrange")

MMR.Select

End Sub

When I Set MMR to = DataSD.Range("MMRrange") the MMRrange refers to a
defined range of cells on the DataSD worksheet. However, I have something
wrong for when I run this program this line gives an error?




--
Thanks
Shawn





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default VBA to select a defined range

This link also helped me:

http://groups-beta.google.com/group/...9892a2449a7ced


--
Thanks
Shawn


"Shawn" wrote:

Thanks in advance to all who help on this site.

I have the below code:


Public Sub MMR()

' Keyboard Shortcut: Ctrl+x

Dim DataSD As Worksheet
Dim MMR As Range
Set MMR = DataSD.Range("MMRrange")

MMR.Select

End Sub

When I Set MMR to = DataSD.Range("MMRrange") the MMRrange refers to a
defined range of cells on the DataSD worksheet. However, I have something
wrong for when I run this program this line gives an error?




--
Thanks
Shawn

Reply
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
How can I see defined name range? smart.daisy Excel Discussion (Misc queries) 2 March 6th 06 03:52 PM
error: ActiveCell.Offset(0, -1).Select = Application-defined or object-defined error -[::::Shamran::::]- Excel Programming 7 June 7th 05 02:14 PM
Defined name range Billabong Excel Programming 0 October 4th 04 04:09 AM
Defined name range Billabong Excel Programming 3 October 4th 04 03:20 AM
Select Sheet then Select Range Gee[_2_] Excel Programming 3 May 27th 04 10:10 PM


All times are GMT +1. The time now is 12:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"