Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Drawing Objects with vba and workbook/worksheet

Hello Usenet group Exelerometers,

I am using vba to draw a circle over a 2-cell range on a worksheet
(thank you for the tip on how to do this).

It seems that I cannot draw my circle on a worksheet in a workbook.
Does the worksheet in the workbook have to be active (aka ActiveSheet)
in order for
drawing to take place?

I have two workbooks - one is the workbook with a worksheet with
buttons, etc, and a bunch of VBA code to make things happen.
I click a button to open an existing workbook. None of the
sheets in the workbook I open are active. I click another button on
my sheet, and it performs some calculations on the book I opened. I
would like to draw a circle over a cell or cells after the calculation
process, but without making the various sheets active.

Thanks,

eholz1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Drawing Objects with vba and workbook/worksheet

I avoid using the active statement. You can refgerence any object without
acttivating (there are some rare exceptions).

with thisworkbook.sheets("sheet1")
.Range("A1") = 5
end with

workbooks.open filename:="c:\abc.xls"
set newbk = activeworkbook
with newbk.sheets("sheet1")
.Range("A1") = 5
end with


the same thing will work with shapes.

"eholz1" wrote:

Hello Usenet group Exelerometers,

I am using vba to draw a circle over a 2-cell range on a worksheet
(thank you for the tip on how to do this).

It seems that I cannot draw my circle on a worksheet in a workbook.
Does the worksheet in the workbook have to be active (aka ActiveSheet)
in order for
drawing to take place?

I have two workbooks - one is the workbook with a worksheet with
buttons, etc, and a bunch of VBA code to make things happen.
I click a button to open an existing workbook. None of the
sheets in the workbook I open are active. I click another button on
my sheet, and it performs some calculations on the book I opened. I
would like to draw a circle over a cell or cells after the calculation
process, but without making the various sheets active.

Thanks,

eholz1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Drawing Objects with vba and workbook/worksheet

Follow Joel's advice, and identify any instance of "select" or "selection"
or "active" in your code as a spot that needs attention.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Joel" wrote in message
...
I avoid using the active statement. You can refgerence any object without
acttivating (there are some rare exceptions).

with thisworkbook.sheets("sheet1")
.Range("A1") = 5
end with

workbooks.open filename:="c:\abc.xls"
set newbk = activeworkbook
with newbk.sheets("sheet1")
.Range("A1") = 5
end with


the same thing will work with shapes.

"eholz1" wrote:

Hello Usenet group Exelerometers,

I am using vba to draw a circle over a 2-cell range on a worksheet
(thank you for the tip on how to do this).

It seems that I cannot draw my circle on a worksheet in a workbook.
Does the worksheet in the workbook have to be active (aka ActiveSheet)
in order for
drawing to take place?

I have two workbooks - one is the workbook with a worksheet with
buttons, etc, and a bunch of VBA code to make things happen.
I click a button to open an existing workbook. None of the
sheets in the workbook I open are active. I click another button on
my sheet, and it performs some calculations on the book I opened. I
would like to draw a circle over a cell or cells after the calculation
process, but without making the various sheets active.

Thanks,

eholz1



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Drawing Objects with vba and workbook/worksheet

On Apr 9, 2:33 pm, "Jon Peltier"
wrote:
Follow Joel's advice, and identify any instance of "select" or "selection"
or "active" in your code as a spot that needs attention.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"Joel" wrote in message

...

I avoid using the active statement. You can refgerence any object without
acttivating (there are some rare exceptions).


with thisworkbook.sheets("sheet1")
.Range("A1") = 5
end with


workbooks.open filename:="c:\abc.xls"
set newbk = activeworkbook
with newbk.sheets("sheet1")
.Range("A1") = 5
end with


the same thing will work with shapes.


"eholz1" wrote:


Hello Usenet group Exelerometers,


I am using vba to draw a circle over a 2-cell range on a worksheet
(thank you for the tip on how to do this).


It seems that I cannot draw my circle on a worksheet in a workbook.
Does the worksheet in the workbook have to be active (aka ActiveSheet)
in order for
drawing to take place?


I have two workbooks - one is the workbook with a worksheet with
buttons, etc, and a bunch of VBA code to make things happen.
I click a button to open an existing workbook. None of the
sheets in the workbook I open are active. I click another button on
my sheet, and it performs some calculations on the book I opened. I
would like to draw a circle over a cell or cells after the calculation
process, but without making the various sheets active.


Thanks,


eholz1


Hello Guys,

Thanks for this info - it will change my code accordingly.

eholz1
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
Drawing Objects pan65 Excel Programming 4 September 4th 06 03:16 AM
Cut Drawing Objects within a range CLR Excel Programming 1 January 20th 06 05:31 PM
Cutting Drawing Objects LostNFound Excel Discussion (Misc queries) 3 August 12th 05 05:35 PM
HOW DO I KEEP DRAWING OBJECTS ANCHORED? HOW DO I KEEP DRAWING OBJECTS ANCHORED? Excel Discussion (Misc queries) 1 May 20th 05 01:35 PM
[Q] parameters to drawing objects Rolf Marvin Bøe Lindgren Excel Programming 1 May 12th 04 10:20 AM


All times are GMT +1. The time now is 09:53 PM.

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"