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: 30
Default Insert Shape Based on Cell Changes

Hi.

I have a graph in Excel which is populated with data based upon a selection
from a drop down box. For some of the selections though there is no data and
an error message comes up and the graph does not display properly.

I want to (using VBA) have a command that executes if there is no data to
populate the graph and temporarily display a text box over the graph to say
data unavailable - that way the graph does not look untidy.

I have put together some code - which is not working - and wondered if
anyone can give me some advice to make it work and also to supress the error
message.

The code I have started is contained in the ThisWorkbook object and is as
follows:

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)

If Sheets("TIA").Range("A38") = 0 Then

If Sh.Name = "TIA" Then

Worksheets("TIA Analysis").Select

ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 195, 18, 425,
268).Select
Selection.Characters.Text = "DATA UNAVAILABLE"
Selection.HorizontalAlignment = xlCenter
With Selection.Characters.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 28
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With

End If
End If

End Sub


Any help would be welcomed.

Thanks.

Liz.
 
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
Show shape on cell select, Hide shape when cell is deselected Max Excel Programming 5 January 27th 10 11:04 AM
Move shape, object, pic to center of new cell based on cell value zzxxcc Excel Programming 4 July 7th 06 12:58 PM
draw shape based on cell values Defoes Right Boot Excel Programming 5 February 10th 06 03:22 PM
Deleting a shape and the cell contents the shape is in. Dave Peterson[_3_] Excel Programming 1 October 9th 03 03:36 PM
Deleting a shape and the cell contents the shape is in. Tom Ogilvy Excel Programming 0 October 9th 03 03:43 AM


All times are GMT +1. The time now is 03:16 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"