Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Excel macro convert to VBA - doesn't work, hangs on Range("Q35").Select

Hi,

I created a macro, then later decided to activate it via a ActiveX Option
Button. As a macro it works fine.

I copied the macro text into the View Code property of the Option button,
and when I step through it in VBA it gives a Run time error 1004 when it
comes to Range("Q35").Select. Interesting because about 10 steps earlier it
handles Range("N23:N34").Select just fine - if I'm on the correct worksheet
to begin with. But the Range("Q35") error occurs no matter if I am on the
correct worksheet.

Any help would be appreciated.

Thanks,

Harold



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel macro convert to VBA - doesn't work, hangs onRange("Q35").Select

You can only select a range if it's on the selected worksheet.

With worksheets("Othersheetnamehere")
.select
.range("Q35").select
end with

But most of the time, you can work directly against the range and avoid the
selecting.

With worksheets("Othersheetnamehere")
.range("Q35").clearcontents 'say
end with

Harold Good wrote:

Hi,

I created a macro, then later decided to activate it via a ActiveX Option
Button. As a macro it works fine.

I copied the macro text into the View Code property of the Option button,
and when I step through it in VBA it gives a Run time error 1004 when it
comes to Range("Q35").Select. Interesting because about 10 steps earlier it
handles Range("N23:N34").Select just fine - if I'm on the correct worksheet
to begin with. But the Range("Q35") error occurs no matter if I am on the
correct worksheet.

Any help would be appreciated.

Thanks,

Harold


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Excel macro convert to VBA - doesn't work, hangs on Range("Q35").Select

Thanks Dave, I don't know VBA yet, but your suggestion worked!

Thanks for your help.

Harold
====================
"Dave Peterson" wrote in message
...
You can only select a range if it's on the selected worksheet.

With worksheets("Othersheetnamehere")
.select
.range("Q35").select
end with

But most of the time, you can work directly against the range and avoid
the
selecting.

With worksheets("Othersheetnamehere")
.range("Q35").clearcontents 'say
end with

Harold Good wrote:

Hi,

I created a macro, then later decided to activate it via a ActiveX Option
Button. As a macro it works fine.

I copied the macro text into the View Code property of the Option button,
and when I step through it in VBA it gives a Run time error 1004 when it
comes to Range("Q35").Select. Interesting because about 10 steps earlier
it
handles Range("N23:N34").Select just fine - if I'm on the correct
worksheet
to begin with. But the Range("Q35") error occurs no matter if I am on the
correct worksheet.

Any help would be appreciated.

Thanks,

Harold


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel macro convert to VBA - doesn't work, hangs on Range("Q35").Select


Hi there, I just finished up solving a similar problem with my own
coding. I wish I could tell you what fixed it, but not really being a
programmer I don't really know. However, the person that fixed it was
Ron de Bruin, and he did a great job. Seek out his help.

Sincerely,
Amber:)


--
Amber_D_Laws
------------------------------------------------------------------------
Amber_D_Laws's Profile: http://www.excelforum.com/member.php...o&userid=30012
View this thread: http://www.excelforum.com/showthread...hreadid=501201

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
Excel hangs after using "Send to mail recipient (as attachment) " Rob Excel Discussion (Misc queries) 1 November 11th 09 10:16 PM
Macro that runs entered value through "low" and "high" range Vika.F Excel Programming 5 August 14th 05 08:35 AM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM
This does not work: Range("A1").Select Bob Excel Programming 2 December 16th 03 08:39 PM
Why doesn't "Workbook.Range("myrange").value" work? Brad Patterson Excel Programming 0 July 9th 03 01:24 AM


All times are GMT +1. The time now is 10:57 AM.

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"