VBA doesn't recognise "selection"

cmhoz

Active Member
Joined
Aug 20, 2006
Messages
268
Hi All - I'm having a bizare problem in VBA.

I have a report that has been running in it's current state for several months with no issue. However, today it has decided that it doesn't understand the word 'selection'.

eg: selection.copy gives compile error.

Now... obviously NOT USING selection is preferred. However, let's put that aside for now because there are LOTS of these in this report and it's never had an issue until today.

Is there some setting that could have gotten changed or something?

It's happening on multiple computers and we're running Excel 2003 (standard) with SP3.

Thanks!!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
there is an issue with SP3 for MS Office. It randomly corrupts MS office programs. I saw it on a website somewhere, but i cannot remember where I saw it. It may be true, and may not be true, but I remember it being a legit website...
 
Upvote 0
Wouldn't that be exciting!

Hoping someone has a less horrible possible answer?!
 
Upvote 0
Hard to help you when you have not posted the code you are using.
What is "Selected" prior to "Selection.Copy" in your code?
 
Upvote 0
Doesn't matter what is selected. It fails on all occassions... doesn't even capitalise 'selection' when you put it in.

I don't think this is an incorrect code issue as it's been running fine for months. I suspect it's a settings issue.. (or a corruption issue).

eg:

something as simple as

range("A1").select
selection.copy

fails. I get a runtime error on the word 'selection'.
 
Upvote 0
is it possible that SELECTION has to be used on more than one cell? Just guessing. I have no idea, just wondering...
 
Upvote 0
Does this happen in another Workbook?

Did you try adding a simple macro to a test Workbook, with Selection?

Sub myTest()
MsgBox Selection.Value
End Sub

Then select a single cell that has any value in it and run the sub?
 
Upvote 0
Hmm. On my computer, it runs fine. On my co-worker's computer, it still fails.

Perhaps this is further proof of corruption??
 
Upvote 0
Open the visual basic editor.. from menubar select tool>references. Then place a checkmark on
Visual basic for application
Microsoft office 11.0 object library
If they are unchecked.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
Hope this helps….
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top