-
macro help
hi
i am trying to use this macro
in excel:
[VBA]Private Sub O6_Click()
Selection.Font.Name = "ARIAL"
Selection.Font.Size = 12
Selection.TypeText Text:="6"
End Sub[/VBA]
it gives me:
object does not support this proporty or method
what can i do to fix this??
TNX
-
Selection can be anything, a shape or a range etc.
Were you thinking ActiveCell.Font. etc.?
That would apply your macro to the currently selected cell
Your could use
[VBA]
If Not TypeOf Selection Is Range Then Exit Sub
[/VBA]
Paul
-
The TypeText is a Word Method, not an Excel method.
Selection = "6" does the same thing.
-
HI
IT WORKS
BUT I HAVE A USRFORM WITH BUTTONS IN THE WORD WHEN I CLICK EACH BUTTON IT WRITES ME A LETTER WHEN I CLICK ATHER BOTTUN IT WRITES ME A LETTER NEXT TO IT KNOW IN EXCEL EACH NEW CLICK REPLACES ME THE OLD ONE
WHAT CAN I DO?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules