LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run-time errors

Hi Rob,

(Thanks also to Tom Ogilvy for your response on this
matter which may highlight potential problems - as a newby
I originally searched for a response via my ISP server &
this was not accessible after a short period of time. I
now know how to access directly from the MS site).

Unfortunately my code is riddled with applucations of the
Select method.

A simple example of how I invoke this is as follows:

Public Sub GetClientMap()
Dim SectRng, MapRng As Range

Range(MapRng(2, 1), MapRng(MapRng.Rows.Count - 1,
MapRng.Columns.Count)).Copy
SectRng(2, 1).Select
ActiveSheet.Paste
End Sub

Are you suggesting I should convert the range contents to
an array or some other method?

Thanks in anticipation,

Tom
-----Original Message-----
Hi Tom,

The best way to prevent this error is not to use the

Select method in
your code. There are almost no situations in VBA that

require you to
explicitly select a cell. Everyone starts out coding this

way because that's
how the macro recorder does it, but it's not really the

best way to do
things. If you post an example of code that's giving you

problems, I'm sure
we can show you how to rewrite it sans Select.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"tielle" wrote in message
...
I have recurring problems with Run-time errors (1004)

with the message
'Select Method of Range Class failed' when using the

Select method on a
Range object within Excel VBA macros.

The same code works successfully many times but seems

to trip up
unexpectedly.

Does anyone have a smart way of avoiding this or can

hint as to how it
might
be occurring? I know for instance it has greater risk

of occurring when a
proedure is run from within the VBE editor than say a

control button in
the
workbook.

Regards,
--

Tom Lambert





.

 
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 remove multiple 'errors' in Excel error checking, at the same time??? [email protected] Excel Discussion (Misc queries) 2 May 11th 23 11:42 AM
#N/A errors when matching time values excelent Excel Worksheet Functions 7 July 28th 06 03:35 PM
Run time errors famdamly Excel Discussion (Misc queries) 3 February 22nd 06 08:01 AM
Excel Run Time Errors baileyphil Excel Discussion (Misc queries) 2 July 21st 05 10:22 AM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM


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

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

About Us

"It's about Microsoft Excel"