Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I see defined name range? | Excel Discussion (Misc queries) | |||
error: ActiveCell.Offset(0, -1).Select = Application-defined or object-defined error | Excel Programming | |||
Defined name range | Excel Programming | |||
Defined name range | Excel Programming | |||
Select Sheet then Select Range | Excel Programming |