PDA

View Full Version : Textbox Macro Comes Up Empty



melsahn
06-18-2009, 05:41 AM
whats up fellas? ---Im having this issue running this textbox macro in vba, everytime i trigger the macro textbox to run, the textbox comes up empty in its range. Has anyone had this problem before? Please any help would be appreciatted. Thanks fellas!



Sub Hello()
'
' Hello Macro

'

'
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 503.25, 348.75, _
238.5, 13.5).Select
Selection.Characters.Text = "Hello"
With Selection.Characters(Start:=1, Length:=31).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.HorizontalAlignment = xlCenter

End Sub

p45cal
06-18-2009, 05:47 AM
re:"Im having this issue running this textbox macro in vba"

It's pretty difficult to tell you what might be wrong with it, since I can't see any code.. maybe that's the problem.

melsahn
06-18-2009, 05:58 AM
There is also a worksheet change event which calls the macro which is...




Sub worksheet_change(ByVal target As Range)
On Error GoTo badchange
If (target = Range("C16")) Then
Select Case target.Value
Case "Hello"
Hello
Case Else
End Select
End If
Case Else
End Select
End If

badchange:
End Sub

Bob Phillips
06-18-2009, 06:07 AM
There were many errors in the second bit of code, but corrected it all seemed to work



Sub worksheet_change(ByVal target As Range)
On Error GoTo badchange
If (target = Range("C16")) Then
Select Case target.Value
Case "Hello"
Hello
Case Else
End Select
End If

badchange:
End Sub

melsahn
06-18-2009, 06:30 AM
Yeah I messed that up a little bit, and it works when I put it in a new sheet, but when I enter that into my project workbook a textbox opens up blank with no info, dont know why??

melsahn
06-18-2009, 08:03 AM
It wasnt working because of the multiple Worksheet Change Events I had placed in that sheet, now i ran into another probblem this is never going to end!!!