Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default VB Code Based on Contents of a Shape

Since you cannot increase the size of an a checkbox in Excel, I'm making one
using VB.

Below is the code that I have compiled to allow the user to check/uncheck a
box...

However in addition to the code below, I need to add code to apply the
contents of the autoshape to a cell on my sheet, therefore if the box is
checked my cell will say true, otherwise it will say false. Please HELP!!!

Sub MyCheckbox_Click()
Dim strName As String
strName = Application.Caller
If Left(strName, 3) < "chk" Then strName = "chk" & strName
If ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = "" Then
ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = "ü"
Else
ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = ""
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default VB Code Based on Contents of a Shape

Not sure if this is what you want but it is one way to doi it.
Assume that Range("A1") is the range that displays "True" or "False"

Sub MyCheckbox_Click()
Dim strName As String
strName = Application.Caller
If Left(strName, 3) < "chk" Then strName = "chk" & strName
If ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = "" Then
ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = "ü"
ActiveSheet.Range("A1") = "True"
Else
ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = ""
ActiveSheet.Range("A1") = "False"
End If
End Sub










"Lost" wrote:

Since you cannot increase the size of an a checkbox in Excel, I'm making one
using VB.

Below is the code that I have compiled to allow the user to check/uncheck a
box...

However in addition to the code below, I need to add code to apply the
contents of the autoshape to a cell on my sheet, therefore if the box is
checked my cell will say true, otherwise it will say false. Please HELP!!!

Sub MyCheckbox_Click()
Dim strName As String
strName = Application.Caller
If Left(strName, 3) < "chk" Then strName = "chk" & strName
If ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = "" Then
ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = "ü"
Else
ActiveSheet.Shapes(strName).TextFrame.Characters.T ext = ""
End If
End Sub

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
code to unhide tabs based on cell contents pat67 Excel Worksheet Functions 7 August 26th 11 12:43 AM
VBA Code to Group Rows Based on Cell Contents pliskers Excel Programming 0 July 9th 06 10:48 PM
Run code based on cell contents Pete JM[_9_] Excel Programming 2 June 22nd 04 07:09 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 06:42 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"