Automatically sketch based on data entered?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to format a cell so that when data is entered, Excel will manually draw a box (or other simple shape) based on the data input? (i.e. If I type the word "box" in A:1, is it possible for Excel to draw a box somewhere within the worksheet - or even export it to another program such as Powerpoint?) I realize this will likely need to be VBA code, but can't seem to find a source for it

I'm really new to VB, but I thought about using text boxes; however, the data will vary widely (i.e. it's numbers, not as simple as the word "box"), so a text box feature will likely be too broad... right

Thanks!
 
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
Select Case LCase(Range("A1").Value)
Case "box": ActiveSheet.Shapes.AddShape msoShapeRectangle, 100,
100, 100, 100
Case "textbox"
With
ActiveSheet.Shapes.AddLabel(msoTextOrientationHorizontal, 100, 100, 100,
100).TextFrame
.AutoSize = True
.Characters.Text = "Textbox"
End With
End Select
End If
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


gracie88 said:
Is it possible to format a cell so that when data is entered, Excel will
manually draw a box (or other simple shape) based on the data input? (i.e.
If I type the word "box" in A:1, is it possible for Excel to draw a box
somewhere within the worksheet - or even export it to another program such
as Powerpoint?) I realize this will likely need to be VBA code, but can't
seem to find a source for it.
I'm really new to VB, but I thought about using text boxes; however, the
data will vary widely (i.e. it's numbers, not as simple as the word "box"),
so a text box feature will likely be too broad... right?
 
I'm having trouble with this too. I tried the code, but it's giving m
error messages and wont open in Excel. I'm new to VBA, so it's quit
possible I'm doing something wrong. Any tips?




O
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top